code: def iter_prepostorder(self, is_leaf_fn=None):
          
          to_visit = [self]
          if is_leaf_fn is not None:
              _leaf = is_leaf_fn
          else:
              _leaf = self.__class__.is_leaf
  
          while to_visit:
              node = to_visit.pop(-1)
              try:
                  node = node[1]
              except TypeError:
                  # PREORDER ACTIONS
                  yield (False, node)
                  if not _leaf(node):
                      # ADD CHILDREN
                      to_visit.extend(reversed(node.children + [[1, node]]))
              else:
                  #POSTORDER ACTIONS
                  yield (True, node)
docs: Iterate over all nodes in a tree yielding every node in both
          pre and post order. Each iteration returns a postorder flag
          (True if node is being visited in postorder) and a node
          instance.