def _find_source(self, obj):
        """Return a list of possible sources for object.

        A Persona qualifies as source if they have obj in their starmaps,
        have a controlled Persona as a contact.

        Args:
            obj (Star, Planet or Starmap): Object to find a source for

        Returns:
            list: Possible sources
        """
        # Return True if at least one of controlled personas is a contact of p
        connected_to = lambda p: len(p.contacts.filter(Persona.crypt_private != "")) > 0

        sources = list()
        if isinstance(obj, Star):
            if connected_to(obj.author):
                sources.append(obj.author)

            for starmap in obj.starmaps:
                if connected_to(starmap.author):
                    sources.append(starmap.author)

        elif isinstance(obj, Planet):
            for star in obj.stars:
                if connected_to(star.author):
                    sources.append(star.author)

                for starmap in star.starmaps:
                    if connected_to(starmap.author):
                        sources.append(starmap.author)

        elif isinstance(obj, Starmap):
            if connected_to(obj.author):
                sources.append(obj.author)

        # TODO: Sort by last seen
        return sources
dataset/ETHPy150Open ciex/souma/synapse/__init__.py/Synapse._find_source/original