human
I wrote the below code

    path = _stringify_path(path)
    inferred_compression = _infer_compression(path, compression)
    def read_wrapper(func):
        (f, fh) = _get_handle(path, 'rb', compression=inferred_compression, is_text=False)
        try:
            return func(f)
        finally:
            for _f in fh:
                _f.close()
    def try_read(path, encoding=None):
        try:
            return read_wrapper((lambda f: pkl.load(f)))
        except Exception:
            try:
                return read_wrapper((lambda f: pc.load(f, encoding=encoding, compat=False)))
            except:
                return read_wrapper((lambda f: pc.load(f, encoding=encoding, compat=True)))
    try:
        return try_read(path)
    except:
        if PY3:
            return try_read(path, encoding='latin1')
        raise

What's a good function header?
assistant
#Here's a good function header.

def read_pickle(path, compression='infer'):