#NEWLINE# def consume_children( self , descendants ) : #NEWLINE# #INDENT# '\n        Helper method to assign the proper children in the proper order to each\n        node\n        ' #NEWLINE# self . _children = [ ] #NEWLINE# while descendants : #NEWLINE# #INDENT# child = descendants [ 0 ] #NEWLINE# if ( child . depth == ( self . depth + 1 ) ) : #NEWLINE# #INDENT# self . _children . append ( descendants . pop ( 0 ) ) #NEWLINE# child . _parent = self #NEWLINE# child . consume_children ( descendants ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# break