def is_recursive(self, seen=None):
        """Check if this domain somehow references itself via its own relations.
        Domains should ideally never reach this state; this function is used to check that they dont.
        """

        if seen is None:
            seen = set()

        if id(self) in seen:
            return True

        seen.add(id(self))

        return any(d.is_recursive(seen=seen) for _, d in self.relations)
Check if this domain somehow references itself via its own relations.
        Domains should ideally never reach this state; this function is used to check that they dont.
        
infinigen/core/constraints/reasoning/domain.py