def get_slot_name_on_primary(self, name: str, tags: Tags) -> Optional[str]:
        """Get the name of physical replication slot for this node on the primary.

        .. note::
            P <-- I <-- L

            In case of cascading replication we have to check not our physical slot, but slot of the replica that
            connects us to the primary.

        :param name: name of the member node to check.
        :param tags: reference to an object implementing :class:`Tags` interface.

        :returns: the slot name on the primary that is in use for physical replication on this node.
        """
        seen_nodes: Set[str] = set()
        while True:
            seen_nodes.add(name)
            if tags.nostream:
                return None
            replicatefrom = self.get_member(tags.replicatefrom, False) \
                if tags.replicatefrom and tags.replicatefrom != name else None
            if not isinstance(replicatefrom, Member):
                return slot_name_from_member_name(name)
            if replicatefrom.name in seen_nodes:
                return None
            name, tags = replicatefrom.name, replicatefrom
Get the name of physical replication slot for this node on the primary.

        .. note::
            P <-- I <-- L

            In case of cascading replication we have to check not our physical slot, but slot of the replica that
            connects us to the primary.

        :param name: name of the member node to check.
        :param tags: reference to an object implementing :class:`Tags` interface.

        :returns: the slot name on the primary that is in use for physical replication on this node.
        
patroni/dcs/__init__.py