def insert_right(self,new_node)if self right_child =noneself right_child binarytree(new_nodeelset binarytree(new_nodet right_child self right_child self right_child to round out the definition for simple binary tree data structurewe will write accessor methods for the left and right childrenas well as the root values def get_right_child(self)return self right_child def get_left_child(self)return self left_child def set_root_val(self,obj)self key obj def get_root_val(self)return self key now that we have all the pieces to create and manipulate binary treelet' use them to check on the structure bit more let' make simple tree with node as the rootand add nodes and as children the code below creates the tree and looks at the some of the values stored in keyleftand right notice that both the left and right children of the root are themselves distinct instances of the binarytree class as we said in our original recursive definition for treethis allows us to treat any child of binary tree as binary tree itself class binarytreedef __init__(selfroot)self key root self left_child none self right_child none def insert_left(selfnew_node)if self left_child =noneself left_child binarytree(new_nodeelset binarytree(new_nodet left_child self left_child self left_child def insert_right(selfnew_node)if self right_child =noneself right_child binarytree(new_nodeelse trees and tree algorithms