#NEWLINE# def _bottom_up( net , term ) : #NEWLINE# #INDENT# if istask ( term ) : #NEWLINE# #INDENT# term = ( ( head ( term ) , ) + tuple ( ( _bottom_up ( net , term ) for t in args ( term ) ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( term , list ) : #NEWLINE# #INDENT# term = [ _bottom_up ( net , t ) for t in args ( term ) ] #NEWLINE# #UNINDENT# #UNINDENT# return net . _rewrite ( term )