def add_preprocessor(preproc):
    """
    Define a preprocessor to run after the arguments are parsed and
    before the function is executed, when running in console script
    mode.

    :param preproc: The callable, which will be passed the Namespace
                    object generated by argparse.
    """

    def decorator(func):
        func = ScriptAdaptor._wrap(func)
        func._add_preprocessor(preproc)
        return func
    return decorator
Define a preprocessor to run after the arguments are parsed and
    before the function is executed, when running in console script
    mode.

    :param preproc: The callable, which will be passed the Namespace
                    object generated by argparse.