def add root(selfe)"""place element at the root of an empty tree and return new position raise valueerror if tree nonempty ""if self root is not noneraise valueerrorroot exists self size self root self node(ereturn self make position(self rootdef add left(selfpe)"""create new left child for position pstoring element return the position of new node raise valueerror if position is invalid or already has left child ""node self validate(pif node left is not noneraise valueerrorleft child exists self size + node is its parent node left self node(enodereturn self make position(node leftdef add right(selfpe)"""create new right child for position pstoring element return the position of new node raise valueerror if position is invalid or already has right child ""node self validate(pif node right is not noneraise valueerrorright child exists self size + node is its parent node right self node(enodereturn self make position(node rightdef replace(selfpe)"""replace the element at position with eand return old element ""node self validate(pold node element node element return old code fragment nonpublic update methods for the linkedbinarytree class (continued in code fragment