def load(filepath):
    '''
    Return data read from filepath as dict
    file may be either json or msgpack given by extension .json or .msgpack
    Otherwise return None
    '''
    try:
        root, ext = os.path.splitext(filepath)
        if ext == '.json':
            with ocfn(filepath, "r") as f:
                it = json.load(f, object_pairs_hook=odict)
        elif ext == '.msgpack':
            if not msgpack:
                raise IOError("Invalid filepath ext '{0}' "
                            "needs msgpack installed".format(filepath))
            with ocfn(filepath, "rb", binary=True) as f:
                it = msgpack.load(f, object_pairs_hook=odict)
        else:
            it = None
    except EOFError:
        return None
    except __HOLE__:
        return None
    return it
dataset/ETHPy150Open ioflo/ioflo/ioflo/aid/filing.py/load