code: def ancestors(self, Class=None):
          
          e = self
          while e:
              if e.parent:
                  e = e.parent
                  if not Class or isinstance(e,Class):
                      yield e
                  elif isinstance(Class, tuple):
                      for C in Class:
                          if isinstance(e,C):
                              yield e
              else:
                  break
docs: Generator yielding all ancestors of this element, effectively back-tracing its path to the root element. A tuple of multiple classes may be specified.
  
          Arguments:
              *Class: The class or classes (:class:`AbstractElement` or subclasses). Not instances!
  
          Yields:
              elements (instances derived from :class:`AbstractElement`)