code: def copy_file(src, dst):
      
      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))
docs: Copy a single file.
  
      :param src: Source name
      :param dst: Destination name