ENH: Rewrite file loading to use Python API.