#NEWLINE# @ misc . disallow_when_frozen ( FrozenNode ) #NEWLINE# def disassociate( self ) : #NEWLINE# #INDENT# 'Removes this node from its parent (if any).\n\n        :returns: occurences of this node that were removed from its parent.\n        ' #NEWLINE# occurrences = 0 #NEWLINE# if ( self . parent is not None ) : #NEWLINE# #INDENT# p = self . parent #NEWLINE# self . parent = None #NEWLINE# while True : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# p . _children . remove ( self ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# occurrences += 1 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return occurrences