#NEWLINE# def find_successor( self ) : #NEWLINE# #INDENT# successor = None #NEWLINE# if self . has_right_child ( ) : #NEWLINE# #INDENT# successor = self . right_child . find_min ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . parent : #NEWLINE# #INDENT# if self . is_left_child ( ) : #NEWLINE# #INDENT# successor = successor . parent #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . parent . right_child = None #NEWLINE# successor = self . parent . find_successor ( ) #NEWLINE# self . parent . right_child = self #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return successor