<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def copy_file(src, dst):
 """Copy a single file. :param src: Source name :param dst: Destination name """

    try:
        fin = os.open(src, READ_FLAGS)
        stat = os.fstat(fin)
        fout = os.open(dst, WRITE_FLAGS, stat.st_mode)
        for x in iter(lambda: os.read(fin, BUFFER_SIZE), b""):
            os.write(fout, x)
    finally:
        try:
            os.close(fin)
        except Exception as exc:
            logger.debug("Failed to close file handle when copying: {}".format(exc))
        try:
            os.close(fout)
        except Exception as exc:
            logger.debug("Failed to close file handle when copying: {}".format(exc))