<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def copytree_atomic(source_path, dest_path, make_parents=False, backup_suffix=None, symlinks=False):
 """ Copy a file or directory recursively, and atomically, reanaming file or top-level dir when done. Unlike shutil.copytree, this will not fail on a file. """

  if os.path.isdir(source_path):
    with atomic_output_file(dest_path, make_parents=make_parents, backup_suffix=backup_suffix) as tmp_path:
      shutil.copytree(source_path, tmp_path, symlinks=symlinks)
  else:
    copyfile_atomic(source_path, dest_path, make_parents=make_parents, backup_suffix=backup_suffix)