def stats(fname, times=True):
    'Return stats on the file which should have been preserved'
    with open(fname) as fd:
        st = os.fstat(fd.fileno())
        stats = (st.st_mode, st.st_uid, st.st_gid, st.st_size)
        if times:
            return (stats + (st.st_atime, st.st_mtime))
        else:
            return stats
Return stats on the file which should have been preserved
def stats(fname, times=True):
    
    with open(fname) as fd:
        st = os.fstat(fd.fileno())
        stats = (st.st_mode, st.st_uid, st.st_gid, st.st_size)
        if times:
            return (stats + (st.st_atime, st.st_mtime))
        else:
            return stats