def METHOD_NAME(node: Node, types: List[str]) -> List[Node]:
    """Crawls the parse tree and only extracts nodes of given types. Doesn't crawl further down if it reaches a
    sought type."""
    if node.expr_name in types:
        return [node]
    result = []
    for child in node.children:
        result.extend(METHOD_NAME(child, types))
    return result