def is_leader(self) -> bool:
        """:returns: `True` if the current node is the leader, based on expiration set when it last held the key."""
        with self._leader_expiry_lock:
            return self._leader_expiry > time.time()
:returns: `True` if the current node is the leader, based on expiration set when it last held the key.
patroni/ha.py