class tree """abstract base class representing tree structure "" nested position class class position """an abstraction representing the location of single element "" def element(self) """return the element stored at this position "" raise notimplementederrormust be implemented by subclass def eq (selfother) """return true if other position represents the same location "" raise notimplementederrormust be implemented by subclass def ne (selfother) """return true if other does not represent the same location "" return not (self =otheropposite of eq abstract methods that concrete subclass must support def root(self) """return position representing the tree root (or none if empty"" raise notimplementederrormust be implemented by subclass def parent(selfp) """return position representing parent (or none if is root"" raise notimplementederrormust be implemented by subclass def num children(selfp) """return the number of children that position has "" raise notimplementederrormust be implemented by subclass def children(selfp) """generate an iteration of positions representing children "" raise notimplementederrormust be implemented by subclass def len (self) """return the total number of elements in the tree "" raise notimplementederrormust be implemented by subclass code fragment portion of our tree abstract base class (continued in code fragment