Filter out all options which are not part of the function *func*
    prototype and returns a set that can be used as kwargs for calling func.

def filter_subcommand_args(func, options):
    """
    Filter out all options which are not part of the function *func*
    prototype and returns a set that can be used as kwargs for calling func.
    """
    kwargs = {}
    argspec = inspect.getargspec(func)
    for arg in argspec.args:
        if arg in options:
            kwargs.update({arg: getattr(options, arg)})
    return kwargs