code: def dfs(self):
          '''
          Depth-first search generator.  Yields `(node, parent)` for every
          node in the tree, beginning with `(self.root, None)`.
          '''
          yield (self.root, None)
          todo = [(self.root[char], self.root) for char in self.root]
          while todo:
              current, parent = todo.pop()
              yield (current, parent)
              for char in current:
                  todo.append((current[char], current)f dfs(self):
          '''
          Depth-first search generator.  Yields `(node, parent)` for every
          node in the tree, beginning with `(self.root, None)`.
          '''
          yield (self.root, None)
          todo = [(self.root[char], self.root) for char in self.root]
          while todo:
              current, parent = todo.pop()
              yield (current, parent)
              for char in current:
                  todo.append((current[char], current))
docs: Depth-first search generator.  Yields `(node, parent)` for every
          node in the tree, beginning with `(self.root, None)`.