code: def _traverse_parent(node, objtypes):
      
      curr_node = node.parent
      while curr_node is not None:
          if isinstance(curr_node, objtypes):
              return curr_node
          curr_node = curr_node.parent
      return None
docs: Traverse up the node's parents until you hit the ``objtypes`` referenced.
  
      Can either be a single type,
      or a tuple of types.