def _flatten_ancestors(self, include_part_of=True):
def get_all_ancestors(term):<EOL><INDENT>ancestors = set()<EOL>for id_ in term.is_a:<EOL><INDENT>ancestors.add(id_)<EOL>ancestors.update(get_all_ancestors(self[id_]))<EOL><DEDENT>if include_part_of:<EOL><INDENT>for id_ in term.part_of:<EOL><INDENT>ancestors.add(id_)<EOL>ancestors.update(get_all_ancestors(self[id_]))<EOL><DEDENT><DEDENT>return ancestors<EOL><DEDENT>for term in self:<EOL><INDENT>term.ancestors = get_all_ancestors(term)<EOL><DEDENT>
Determines and stores all ancestors of each GO term.

        Parameters
        ----------
        include_part_of: bool, optional
            Whether to include ``part_of`` relations in determining
            ancestors.

        Returns
        -------
        None