def copystat(src, dst):
st = os.stat(src)<EOL>mode = stat.S_IMODE(st.st_mode)<EOL>if hasattr(os, '<STR_LIT>'):<EOL><INDENT>os.utime(dst, (st.st_atime, st.st_mtime))<EOL><DEDENT>if hasattr(os, '<STR_LIT>'):<EOL><INDENT>os.chmod(dst, mode)<EOL><DEDENT>if hasattr(os, '<STR_LIT>') and hasattr(st, '<STR_LIT>'):<EOL><INDENT>try:<EOL><INDENT>os.chflags(dst, st.st_flags)<EOL><DEDENT>except OSError as why:<EOL><INDENT>if (not hasattr(errno, '<STR_LIT>') or<EOL>why.errno != errno.EOPNOTSUPP):<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>
Copy all stat info (mode bits, atime, mtime, flags) from src to dst