def depth_first_iter(self, self_first=True):
        """
        Iterate over nodes below this node, optionally yielding children before
        self.
        """
        if self_first:
            yield self
        for child in list(self.children):
            for i in child.depth_first_iter(self_first):
                yield i
        if not self_first:
            yield self
def depth_first_iter ( self , self_first = True ) : if self_first : yield self for child in list ( self . children ) : for i in child . depth_first_iter ( self_first ) : yield i if not self_first : yield self
Iterate over nodes below this node, optionally yielding children before
        self.