#NEWLINE# def traverse_breadth_first( self , callback , queue ) : #NEWLINE# #INDENT# '\n            Traverses the tree in breadth-first top-down order,\n            calling the callback function in each node.\n            The callback function should take the node as its parameter.\n    \n            ' #NEWLINE# callback ( self ) #NEWLINE# for k in self . children : #NEWLINE# #INDENT# queue . append ( self . children [ k ] ) #NEWLINE# #UNINDENT# if queue : #NEWLINE# #INDENT# queue [ 0 ] . traverse_breadh_first_top_down ( callback , queue [ 1 : ] )