code: def iterator(n: Union[Node, CompatNodeIterator, dict],
          order: TreeOrder = TreeOrder.PRE_ORDER) -> CompatNodeIterator:
      
  
      if isinstance(n, CompatNodeIterator):
          return CompatNodeIterator(n._nodeit.iterate(order), only_nodes=True)
      elif isinstance(n, Node):
          nat_it = native_iterator(n.internal_node, order)
          return CompatNodeIterator(NodeIterator(nat_it), only_nodes=True)
      elif isinstance(n, dict):
          nat_it = native_iterator(n, order)
          return CompatNodeIterator(NodeIterator(nat_it, uast()), only_nodes=True)
      else:
          raise WrongTypeException(
              "iterator on non node or iterator type (%s)" % str(type(n))
          )
docs: This function has the same signature as the pre-v3 iterator()
      call returning a compatibility CompatNodeIterator.