code: def ancestor(self, index):
          
          if not isinstance(index, int):
              self.log_exc(u"index is not an integer", None, True, TypeError)
          if index < 0:
              self.log_exc(u"index cannot be negative", None, True, ValueError)
          parent_node = self
          for i in range(index):
              if parent_node is None:
                  break
              parent_node = parent_node.parent
          return parent_node
docs: Return the ``index``-th ancestor.
  
          The 0-th ancestor is the node itself,
          the 1-th ancestor is its parent node,
          etc.
  
          :param int index: the number of levels to go up
          :rtype: :class:`~aeneas.tree.Tree`
          :raises: TypeError if ``index`` is not an int
          :raises: ValueError if ``index`` is negative