code: def ancestors(self, node):
          
          # We need to use the path virtual field, so ensure it exists.
          self._ensure_virtual_fields(node)
          return self.filter(pk__in=getattr(node, self.model._cte_node_path)[:-1])
docs: Returns a :class:`QuerySet` of all ancestors of a given
              :class:`CTENode` `node`.
  
              :param node: A :class:`CTENode` whose ancestors are required.
  
              :returns: A :class:`QuerySet` of all ancestors of the given `node`.