def METHOD_NAME(parser, cmdname) -> Optional[argparse.ArgumentParser]:
    # pylint: disable=protected-access
    # Get cmdname from the parse result.
    root_dest = 'cmd'
    subparser = None
    for action in parser._actions:
        if action.dest == root_dest:
            subparser = action._name_parser_map[cmdname]  # type: ignore
            break
    return subparser