if self is_leaf()if self is_left_child()self parent left_child none elseself parent right_child none elif self has_any_children()if self has_left_child()if self is_left_child()self parent left_child self left_child elseself parent right_child self left_child self left_child parent self parent elseif self is_left_child()self parent left_child self right_child elseself parent right_child self right_child self right_child parent self parent def find_successor(self)succ none if self has_right_child()succ self right_child find_min(elseif self parentif self is_left_child()succ self parent elseself parent right_child none succ self parent find_successor(self parent right_child self return succ def find_min(self)current self while current has_left_child()current current left_child return current def remove(selfcurrent_node)if current_node is_leaf()#leaf if current_node =current_node parent left_childcurrent_node parent left_child none elsecurrent_node parent right_child none elif current_node has_both_children()interior succ current_node find_successor(succ splice_out(current_node key succ key current_node payload succ payload binary search trees