def levels(self, min_level=0): """An iterator over levels, yields all the nodes in each level""" for i in range(min_level,self.depth): yield self.level(i)