def run(parser, command_string, kwargs=None, exit=False):
kwargs = kwargs or {}<EOL>try:<EOL><INDENT>return call_cmd(parser, command_string, **kwargs)<EOL><DEDENT>except SystemExit as error:<EOL><INDENT>if exit:<EOL><INDENT>if error.args == (None,):<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>return str(error)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if exit:<EOL><INDENT>raise AssertionError('<STR_LIT>')<EOL><DEDENT><DEDENT>
Calls the command and returns result.

    If SystemExit is raised, it propagates.

    :exit:
        if set to `True`, then any SystemExit exception is caught and its
        string representation is returned; if the exception is not raised,
        an AssertionError is raised.  In other words, this parameter inverts
        the function's behaviour and expects SystemExit as the correct event.