def write_sync_state(self, leader: Optional[str], sync_standby: Optional[Collection[str]],
                         quorum: Optional[int], version: Optional[Any] = None) -> Optional[SyncState]:
        """Write the new synchronous state to DCS.

        Calls :meth:`~AbstractDCS.sync_state` to build a dictionary and then calls DCS specific
        :meth:`~AbstractDCS.set_sync_state_value`.

        :param leader: name of the leader node that manages ``/sync`` key.
        :param sync_standby: collection of currently known synchronous standby node names.
        :param version: for conditional update of the key/object.
        :param quorum: if the node from :attr:`~SyncState.sync_standby` list is doing a leader race it should
                       see at least :attr:`~SyncState.quorum` other nodes from the
                       :attr:`~SyncState.sync_standby` + :attr:`~SyncState.leader` list

        :returns: the new :class:`SyncState` object or ``None``.
        """
        sync_value = self.sync_state(leader, sync_standby, quorum)
        ret = self.set_sync_state_value(json.dumps(sync_value, separators=(',', ':')), version)
        if not isinstance(ret, bool):
            return SyncState.from_node(ret, sync_value)
        return None
Write the new synchronous state to DCS.

        Calls :meth:`~AbstractDCS.sync_state` to build a dictionary and then calls DCS specific
        :meth:`~AbstractDCS.set_sync_state_value`.

        :param leader: name of the leader node that manages ``/sync`` key.
        :param sync_standby: collection of currently known synchronous standby node names.
        :param version: for conditional update of the key/object.
        :param quorum: if the node from :attr:`~SyncState.sync_standby` list is doing a leader race it should
                       see at least :attr:`~SyncState.quorum` other nodes from the
                       :attr:`~SyncState.sync_standby` + :attr:`~SyncState.leader` list

        :returns: the new :class:`SyncState` object or ``None``.
        
patroni/dcs/__init__.py