def adopt(self):
        """Make terms aware of their children.

        This is done automatically when using the `~Ontology.merge` and
        `~Ontology.include` methods as well as the `~Ontology.__init__`
        method, but it should be called in case of manual editing of the
        parents or children of a `Term`.

        """
        valid_relationships = set(Relationship._instances.keys())

        relationships = [
            (parent, relation.complement(), term.id)
                for term in six.itervalues(self.terms)
                    for relation in term.relations
                        for parent in term.relations[relation]
                            if relation.complementary
                                and relation.complementary in valid_relationships
        ]

        relationships.sort(key=operator.itemgetter(2))

        for parent, rel, child in relationships:

            if rel is None:
                break

            try:
                parent = parent.id
            except AttributeError:
                pass

            if parent in self.terms:
                try:
                    if child not in self.terms[parent].relations[rel]:
                        self.terms[parent].relations[rel].append(child)
                except KeyError:
                    self[parent].relations[rel] = [child]

        del relationships
Make terms aware of their children.

        This is done automatically when using the `~Ontology.merge` and
        `~Ontology.include` methods as well as the `~Ontology.__init__`
        method, but it should be called in case of manual editing of the
        parents or children of a `Term`.