code: def process_unhealthy_cluster(self):
          
  
          if self.is_healthiest_node():
              if self.acquire_lock():
                  failover = self.cluster.failover
                  if failover:
                      if self.is_paused() and failover.leader and failover.candidate:
                          logger.info('Updating failover key after acquiring leader lock...')
                          self.dcs.manual_failover('', failover.candidate, failover.scheduled_at, failover.index)
                      else:
                          logger.info('Cleaning up failover key after acquiring leader lock...')
                          self.dcs.manual_failover('', '')
                  self.load_cluster_from_dcs()
  
                  if self.is_standby_cluster():
                      # standby leader disappeared, and this is a healthiest
                      # replica, so it should become a new standby leader.
                      # This imply that we need to start following a remote master
                      msg = 'promoted self to a standby leader by acquiring session lock'
                      return self.enforce_follow_remote_master(msg)
                  else:
                      return self.enforce_master_role(
                          'acquired session lock as a leader',
                          'promoted self to leader by acquiring session lock'
                      )
              else:
                  return self.follow('demoted self after trying and failing to obtain lock',
                                     'following new leader after trying and failing to obtain lock')
          else:
              # when we are doing manual failover there is no guaranty that new leader is ahead of any other node
              # node tagged as nofailover can be ahead of the new leader either, but it is always excluded from elections
              if bool(self.cluster.failover) or self.patroni.nofailover:
                  self.state_handler.trigger_check_diverged_lsn()
                  time.sleep(2)  # Give a time to somebody to take the leader lock
  
              if self.patroni.nofailover:
                  return self.follow('demoting self because I am not allowed to become master',
                                     'following a different leader because I am not allowed to promote')
              return self.follow('demoting self because i am not the healthiest node',
                                 'following a different leader because i am not the healthiest node')
docs: Cluster has no leader key