Call the function as a console script.  Command line arguments
        are parsed, preprocessors are called, then the function is
        called.  If a 'debug' attribute is set by the command line
        arguments, and it is True, any exception raised by the
        underlying function will be reraised; otherwise, the return
        value will be either the return value of the function or the
        text contents of the exception.

def console(self):
        """
        Call the function as a console script.  Command line arguments
        are parsed, preprocessors are called, then the function is
        called.  If a 'debug' attribute is set by the command line
        arguments, and it is True, any exception raised by the
        underlying function will be reraised; otherwise, the return
        value will be either the return value of the function or the
        text contents of the exception.
        """

        # First, let's parse the arguments
        parser = argparse.ArgumentParser(description=self.description)
        self.setup_args(parser)
        args = parser.parse_args()

        # Next, let's run the preprocessors in order
        for proc in self._preprocess:
            try:
                proc(args)
            except Exception as exc:
                if getattr(args, 'debug', False):
                    raise
                return str(exc)

        # Finally, safely call the underlying function
        result = self.safe_call(self.get_kwargs(args), args)

        # Now, run the postprocessors in order
        for proc in self._postprocess:
            result = proc(args, result)

        return result