#NEWLINE# def AttachParents( self , tree , parent = None ) : #NEWLINE# #INDENT# ' Attach parents to the tree.\n    Also create the cache at the each node, by exercising\n    tree.GetFlattenedChildren().' #NEWLINE# tree . SetParent ( e ) #NEWLINE# for c in tree . GetFlattenedChildren ( ) : #NEWLINE# #INDENT# if ( c is not None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . AttachParents ( c , tree ) #NEWLINE# #UNINDENT# except AttributeError as e : #NEWLINE# #INDENT# print ( c , parent , tree ) #NEWLINE# raise AttributeError ( e ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return