def __repr__(self)return '*def lookup(selfvalue)return false def insert(selfvalue)return binarynode(selfvalueselfclass binarynodedef __init__(selfleftvalueright)self dataself leftself right fail at the bottom add new node at bottom valueleftright def lookup(selfvalue)if self data =valuereturn true elif self data valuereturn self left lookup(valueelsereturn self right lookup(valuedef insert(selfvalue)if self data valueself left self left insert(valueelif self data valueself right self right insert(valuereturn self look in left look in right grow in left grow in right def __repr__(self)return ('% % % )(repr(self left)repr(self data)repr(self right))as usualbinarytree can contain objects of any type that support the expected interface protocol--hereand comparisons this includes class instances with the __lt__ and __gt__ methods let' experiment with this module' interfaces the following code stuffs five integers into new treeand then searches for values as we did earlier for dictionaries and setsc:\pp \dstruct\classicspython from btree import binarytree binarytree(for in [ ] insert(ifor in range( )print((ix lookup( ))end='( false( true( true( true( false( false( false( trueto watch this tree growadd print call statement after each insert tree nodes print themselves as triplesand empty nodes print as the result reflects tree nestingy binarytree( for in [ ] insert( )print(ybinary search trees