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))
def dfs ( self ) : 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 ) )
Depth-first search generator.  Yields `(node, parent)` for every
        node in the tree, beginning with `(self.root, None)`.