def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=<NUM_LIT:0>,<EOL>dry_run=<NUM_LIT:0>, owner=None, group=None, logger=None):
save_cwd = os.getcwd()<EOL>if root_dir is not None:<EOL><INDENT>if logger is not None:<EOL><INDENT>logger.debug("<STR_LIT>", root_dir)<EOL><DEDENT>base_name = os.path.abspath(base_name)<EOL>if not dry_run:<EOL><INDENT>os.chdir(root_dir)<EOL><DEDENT><DEDENT>if base_dir is None:<EOL><INDENT>base_dir = os.curdir<EOL><DEDENT>kwargs = {'<STR_LIT>': dry_run, '<STR_LIT>': logger}<EOL>try:<EOL><INDENT>format_info = _ARCHIVE_FORMATS[format]<EOL><DEDENT>except KeyError:<EOL><INDENT>raise ValueError("<STR_LIT>" % format)<EOL><DEDENT>func = format_info[<NUM_LIT:0>]<EOL>for arg, val in format_info[<NUM_LIT:1>]:<EOL><INDENT>kwargs[arg] = val<EOL><DEDENT>if format != '<STR_LIT>':<EOL><INDENT>kwargs['<STR_LIT>'] = owner<EOL>kwargs['<STR_LIT>'] = group<EOL><DEDENT>try:<EOL><INDENT>filename = func(base_name, base_dir, **kwargs)<EOL><DEDENT>finally:<EOL><INDENT>if root_dir is not None:<EOL><INDENT>if logger is not None:<EOL><INDENT>logger.debug("<STR_LIT>", save_cwd)<EOL><DEDENT>os.chdir(save_cwd)<EOL><DEDENT><DEDENT>return filename<EOL>
Create an archive file (eg. zip or tar).

    'base_name' is the name of the file to create, minus any format-specific
    extension; 'format' is the archive format: one of "zip", "tar", "bztar"
    or "gztar".

    'root_dir' is a directory that will be the root directory of the
    archive; ie. we typically chdir into 'root_dir' before creating the
    archive.  'base_dir' is the directory where we start archiving from;
    ie. 'base_dir' will be the common prefix of all files and
    directories in the archive.  'root_dir' and 'base_dir' both default
    to the current directory.  Returns the name of the archive file.

    'owner' and 'group' are used when creating a tar archive. By default,
    uses the current owner and group.