code: def preorder(self, funct, stopOn=None):
          
          if funct(self.symbol) == stopOn and stopOn is not None:
              return stopOn
  
          if stopOn is None:
              for i in self.children:
                  i.preorder(funct)
          else:
              for i in self.children:
                  if i.preorder(funct) == stopOn:
                      return stopOn
docs: Iterates in preorder, calling the function with the current node.
              If stopOn is set to True or False, it will stop on true or false.