def _make_tarball(base_name, base_dir, compress="<STR_LIT>", verbose=<NUM_LIT:0>, dry_run=<NUM_LIT:0>,<EOL>owner=None, group=None, logger=None):
tar_compression = {'<STR_LIT>': '<STR_LIT>', None: '<STR_LIT>'}<EOL>compress_ext = {'<STR_LIT>': '<STR_LIT>'}<EOL>if _BZ2_SUPPORTED:<EOL><INDENT>tar_compression['<STR_LIT>'] = '<STR_LIT>'<EOL>compress_ext['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>if compress is not None and compress not in compress_ext:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>".format(compress))<EOL><DEDENT>archive_name = base_name + '<STR_LIT>' + compress_ext.get(compress, '<STR_LIT>')<EOL>archive_dir = os.path.dirname(archive_name)<EOL>if not os.path.exists(archive_dir):<EOL><INDENT>if logger is not None:<EOL><INDENT>logger.info("<STR_LIT>", archive_dir)<EOL><DEDENT>if not dry_run:<EOL><INDENT>os.makedirs(archive_dir)<EOL><DEDENT><DEDENT>if logger is not None:<EOL><INDENT>logger.info('<STR_LIT>')<EOL><DEDENT>uid = _get_uid(owner)<EOL>gid = _get_gid(group)<EOL>def _set_uid_gid(tarinfo):<EOL><INDENT>if gid is not None:<EOL><INDENT>tarinfo.gid = gid<EOL>tarinfo.gname = group<EOL><DEDENT>if uid is not None:<EOL><INDENT>tarinfo.uid = uid<EOL>tarinfo.uname = owner<EOL><DEDENT>return tarinfo<EOL><DEDENT>if not dry_run:<EOL><INDENT>tar = tarfile.open(archive_name, '<STR_LIT>' % tar_compression[compress])<EOL>try:<EOL><INDENT>tar.add(base_dir, filter=_set_uid_gid)<EOL><DEDENT>finally:<EOL><INDENT>tar.close()<EOL><DEDENT><DEDENT>return archive_name<EOL>
Create a (possibly compressed) tar file from all the files under
    'base_dir'.

    'compress' must be "gzip" (the default), "bzip2", or None.

    '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_name' +  ".tar", possibly plus
    the appropriate compression extension (".gz", or ".bz2").

    Returns the output filename.