docs: def index(self, obj, recursive=False):
          """Return the index of *obj* in the list of nodes.
  
          Raises :exc:`ValueError` if *obj* is not found. If *recursive* is
          ``True``, we will look in all nodes of ours and their descendants, and
          return the index of our direct descendant node within *our* list of
          nodes. Otherwise, the lookup is done only on direct descendants.
          """
          strict = isinstance(obj, Node)
          equivalent = (lambda o, n: o is n) if strict else (lambda o, n: o == n)
          for i, node in enumerate(self.nodes):
              if recursive:
                  for child in self._get_children(node):
                      if equivalent(obj, child):
                          return i
              elif equivalent(obj, node):
                  return i
          raise ValueError(obj)