class_docstr: The base class for nodes and leaves.
class_docstr_tok: ["The","base","class","for","nodes","and","leaves","."]
docstr: Recursively looks at the parents of this node or leaf and returns the
  first found node that matches ``node_types``. Returns ``None`` if no
  matching node is found.
  
  :param node_types: type names that are searched for.
code: def search_ancestor(self, *node_types: str) -> "Optional[BaseNode]":
      """
      Recursively looks at the parents of this node or leaf and returns the
      first found node that matches ``node_types``. Returns ``None`` if no
      matching node is found.
  
      :param node_types: type names that are searched for.
      """
      node = self.parent
      while node is not None:
          if node.type in node_types:
              return node
          node = node.parent
      return None
  
imports: from abc import abstractmethod, abstractproperty
  from typing import List, Optional, Tuple, Union
  from parso.utils import split_lines
label_desc: Use image node_id 12 for calling the NodeOrLeaf obj's underlying member method code with example usage: obj.search_ancestor() and returns: None, node