code: def GetAncestors(self):
      
      current = self
      while True:
        current = current.GetParent()
        if current is None:
          return
        yield current
docs: Yields all ancestors of a path.
  
      The ancestors are returned in order from closest to the farthest one.
  
      Yields:
        Instances of `rdf_objects.PathInfo`.