def group(*args, **kwargs):
def decorator(f):<EOL><INDENT>f.required = kwargs.pop('<STR_LIT>', True)<EOL>if '<STR_LIT>' in kwargs:<EOL><INDENT>if not hasattr(f, '<STR_LIT>'):  <EOL><INDENT>f._argnames = []<EOL><DEDENT>for p in kwargs['<STR_LIT>']:<EOL><INDENT>f._argnames += p._argnames if hasattr(p, '<STR_LIT>') else []<EOL><DEDENT>kwargs['<STR_LIT>'] = [p.parser for p in kwargs['<STR_LIT>']]<EOL><DEDENT>f.parser = argparse.ArgumentParser(*args, **kwargs)<EOL>f.climax = True<EOL>for arg in getattr(f, '<STR_LIT>', []):<EOL><INDENT>f.parser.add_argument(*arg[<NUM_LIT:0>], **arg[<NUM_LIT:1>])<EOL><DEDENT>f._subparsers = f.parser.add_subparsers()<EOL>f.command = partial(_subcommand, f)<EOL>f.group = partial(_subgroup, f)<EOL>@wraps(f)<EOL>def wrapper(args=None):<EOL><INDENT>parsed_args = vars(f.parser.parse_args(args))<EOL>func = f<EOL>while '<STR_LIT>' + func.__name__ in parsed_args:<EOL><INDENT>func = parsed_args.get('<STR_LIT>' + func.__name__)<EOL><DEDENT>if getattr(func, '<STR_LIT>', False):<EOL><INDENT>f.parser.error('<STR_LIT>')<EOL><DEDENT>filtered_args = {arg: parsed_args[arg]<EOL>for arg in parsed_args.keys()<EOL>if arg in getattr(f, '<STR_LIT>', [])}<EOL>parsed_args = {arg: parsed_args[arg] for arg in parsed_args.keys()<EOL>if arg not in filtered_args}<EOL>ctx = f(**filtered_args)<EOL>func = f<EOL>while '<STR_LIT>' + func.__name__ in parsed_args:<EOL><INDENT>func = parsed_args.pop('<STR_LIT>' + func.__name__)<EOL>if getattr(func, '<STR_LIT>', False):<EOL><INDENT>filtered_args = {arg: parsed_args[arg]<EOL>for arg in parsed_args.keys()<EOL>if arg in getattr(func, '<STR_LIT>', [])}<EOL>parsed_args = {arg: parsed_args[arg]<EOL>for arg in parsed_args.keys()<EOL>if arg not in filtered_args}<EOL><DEDENT>else:<EOL><INDENT>filtered_args = parsed_args<EOL>parsed_args = {}<EOL><DEDENT>filtered_args.update(ctx or {})<EOL>ctx = func(**filtered_args)<EOL><DEDENT>return ctx<EOL><DEDENT>return wrapper<EOL><DEDENT>return decorator<EOL>
Decorator to define a command group.

    The arguments to this decorator are those of the
    `ArgumentParser <https://docs.python.org/3/library/argparse.html\
argumentparser-objects>`_
    object constructor.