@contextlib.contextmanager
def save_pos(fh):
    orig_pos = fh.tell()
    fh.seek(0)
    try:
        yield fh
    finally:
        fh.seek(orig_pos)
Save the position of the file handle, seek to the beginning, and
dataset/ETHPy150Open jseutter/ofxparse/ofxparse/ofxparse.py/save_pos