code: def filter_nodes(n: Node, query: str) -> CompatNodeIterator:
      
      return CompatNodeIterator(filter(n, query)._nodeit, only_nodes=True)
docs: Utility function. Same as filter() but will only filter for nodes (i. e.
      it will exclude scalars and positions).