code: def dfs_preorder(self, reverse=False):
          
          stack = deque()
          stack.append(self)
          while stack:
              node = stack.pop()
              yield node
              if hasattr(node, "childs"):
                  if reverse:
                      stack.extend(node.childs)
                  else:
                      stack.extend(node.childs[::-1])
docs: Generator that returns each element of the tree in Preorder order.
          Keyword arguments:
          reverse -- if true, the search is done from right to left.