def __handle_replication_factor_change(self) -> Iterator[Transition]:
        """Handle change of the replication factor (:attr:`sync_wanted`, aka ``synchronous_node_count``).

        :yields: transitions as :class:`Transition` objects.
        """
        # Apply requested replication factor change
        sync_increase = min(self.sync_wanted, len(self.sync)) - self.numsync
        if sync_increase > 0:
            # Increase replication factor
            logger.debug("Increasing replication factor to %s", self.numsync + sync_increase)
            yield from self.sync_update(self.numsync + sync_increase, self.sync)
            yield from self.quorum_update(len(self.voters) - self.numsync, self.voters)
        elif sync_increase < 0:
            # Reduce replication factor
            logger.debug("Reducing replication factor to %s", self.numsync + sync_increase)
            if self.quorum - sync_increase < len(self.voters):
                yield from self.quorum_update(len(self.voters) - self.numsync - sync_increase, self.voters,
                                              adjust_quorum=self.sync_wanted > self.numsync_confirmed)
            yield from self.sync_update(self.numsync + sync_increase, self.sync)
Handle change of the replication factor (:attr:`sync_wanted`, aka ``synchronous_node_count``).

        :yields: transitions as :class:`Transition` objects.
        
patroni/quorum.py