def acquire_leader_lock(self) -> bool:
        """Attempt to acquire leader lock.

        .. note::
            This method wraps :meth:`~AbstractDCS.attempt_to_acquire_leader`: and is
            used to reset retention time of physical replication slots that representing
            members of the cluster when current node is to be promoted to the leader.

        :returns: ``True`` if the leader key has been created successfully.
        """
        ret = self.attempt_to_acquire_leader()
        if ret:
            timestamp = time.time()
            # every time we promote we need to reset retention time for slots recorded in the /status key
            self._last_retain_slots = {name: timestamp for name in self._last_status['retain_slots']}
        return ret
Attempt to acquire leader lock.

        .. note::
            This method wraps :meth:`~AbstractDCS.attempt_to_acquire_leader`: and is
            used to reset retention time of physical replication slots that representing
            members of the cluster when current node is to be promoted to the leader.

        :returns: ``True`` if the leader key has been created successfully.
        
patroni/dcs/__init__.py