def _apply2parser(arguments, options, parser):
    """
    :return the parser itself
    :type arguments: list[list[T], dict[str, T]]
    :type options: list[list[T], dict[str, T]]
    :type parser: cmdtree.parser.AParser
    :rtype: cmdtree.parser.AParser
    """
    for args, kwargs in options:
        parser.option(*args, **kwargs)
    for args, kwargs in arguments:
        parser.argument(*args, **kwargs)
    return parser
