def command(func):
classname = inspect.getouterframes(inspect.currentframe())[<NUM_LIT:1>][<NUM_LIT:3>]<EOL>name = func.__name__<EOL>help_name = name.replace("<STR_LIT>", "<STR_LIT>")<EOL>doc = textwrap.dedent(func.__doc__)<EOL>def new(instance, args):<EOL><INDENT>try:<EOL><INDENT>argv = shlex.split(args)<EOL>arguments = docopt(doc, help=True, argv=argv)<EOL>func(instance, args, arguments)<EOL><DEDENT>except SystemExit:<EOL><INDENT>if args not in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>Console.error("<STR_LIT>")<EOL><DEDENT>print(doc)<EOL><DEDENT><DEDENT>new.__doc__ = doc<EOL>return new<EOL>
A decorator to create a function with docopt arguments. It also generates a help function

@command
def do_myfunc(self, args):
    """ docopts text """
    pass

will create

def do_myfunc(self, args, arguments):
    """ docopts text """
    ...

def help_myfunc(self, args, arguments):
    ... prints the docopt text ...

:param func: the function for the decorator