code: def depth(self, pos):
          
          parent = self.parent_position(pos)
          if parent is None:
              return 0
          else:
              return self.depth(parent) + 1
docs: determine depth of node at pos