code: def make_tarball(
      base_name,
      base_dir,
      compress="gzip",
      verbose=0,
      dry_run=0,
      owner=None,
      group=None,
  ):
      """Create a (possibly compressed) tar file from all the files under
      'base_dir'.
  
      'compress' must be "gzip" (the default), "bzip2", "xz", "compress", or
      None.  ("compress" will be deprecated in Python 3.2)
  
      'owner' and 'group' can be used to define an owner and a group for the
      archive that is being built. If not provided, the current owner and group
      will be used.
  
      The output tar file will be named 'base_dir' +  ".tar", possibly plus
      the appropriate compression extension (".gz", ".bz2", ".xz" or ".Z").
  
      Returns the output filename.
      """
      tar_compression = {
          "gzip": "gz",
          "bzip2": "bz2",
          "xz": "xz",
          None: "",
          "compress": "",
      }
      compress_ext = {
          "gzip": ".gz",
          "bzip2": ".bz2",
          "xz": ".xz",
          "compress": ".Z",
      }
  
      # flags for compression program, each element of list will be an argument
      if compress is not None and compress not in compress_ext.keys():
          raise ValueError(
              "bad value for 'compress': must be None, 'gzip', 'bzip2', "
              "'xz' or 'compress'"
          )
  
      archive_name = base_name + ".tar"
      if compress != "compress":
          archive_name += compress_ext.get(compress, "")
  
      mkpath(os.path.dirname(archive_name), dry_run=dry_run)
  
      # creating the tarball
      import tarfile  # late import so Python build itself doesn't break
  
      log.info("Creating tar archive")
  
      uid = _get_uid(owner)
      gid = _get_gid(group)
  
      def _set_uid_gid(tarinfo):
          if gid is not None:
              tarinfo.gid = gid
              tarinfo.gname = group
          if uid is not None:
              tarinfo.uid = uid
              tarinfo.uname = owner
          return tarinfo
  
      if not dry_run:
          tar = tarfile.open(
              archive_name, "w|%s" % tar_compression[compress]
          )
          try:
              tar.add(base_dir, filter=_set_uid_gid)
          finally:
              tar.close()
  
      # compression using `compress`
      if compress == "compress":
          warn("'compress' is deprecated.", DeprecationWarning)
          # the option varies depending on the platform
          compressed_name = archive_name + compress_ext[compress]
          if sys.platform == "win32":
              cmd = [compress, archive_name, compressed_name]
          else:
              cmd = [compress, "-f", archive_name]
          spawn(cmd, dry_run=dry_run)
          return compressed_name
  
      return archive_name
  
file_path: catboost/contrib/python/setuptools/py3/setuptools/_distutils/archive_util.py
imports: import os
  from warnings import warn
  import sys
  from .errors import DistutilsExecError
  from .spawn import spawn
  from .dir_util import mkpath
  from ._log import log
label_desc: Use image node_id 3 for calling a global function with example usage: make_tarball(base_name, base_dir, compress, verbose, dry_run, owner, group) and returns: archive_name, tarinfo, compressed_name