code: def main():
      opts = parse_args()
  
      dest_arch = None
      if opts.dest_arch:
          if opts.dest_arch.endswith(".tar"):
              dest_arch = tarfile.open(
                  opts.dest_arch, "w", dereference=True
              )
          elif opts.dest_arch.endswith(
              ".tar.gz"
          ) or opts.dest_arch.endswith(".tgz"):
              dest_arch = tarfile.open(
                  opts.dest_arch, "w:gz", dereference=True
              )
          else:
              # TODO: move check to graph generation stage
              raise Exception(
                  "Unsopported archive type for {}. Use one of: tar, tar.gz, tgz.".format(
                      os.path.basename(opts.dest_arch)
                  )
              )
  
      for arg in opts.args:
          dst = arg
          if dst.startswith(opts.build_root):
              dst = dst[len(opts.build_root) + 1 :]
  
          if dest_arch and not arg.endswith(".pkg.fake"):
              dest_arch.add(arg, arcname=dst)
  
          dst = os.path.join(opts.dest_dir, dst)
          ensure_dir_exists(os.path.dirname(dst))
          hardlink_or_copy(arg, dst)
  
      if dest_arch:
          dest_arch.close()
  
file_path: catboost/build/scripts/copy_to_dir.py
imports: import argparse
  import errno
  import sys
  import os
  import shutil
  import tarfile
label_desc: Use image node_id 4 for calling a global function with example usage: main() without return types