code: def rebalancing_non_followers(self, opt_cnt):
          
          # Don't include leaders if they are marked for leadership removal
          under_brokers = list(filter(
              lambda b: b.count_preferred_replica() < opt_cnt and not b.revoked_leadership,
              six.itervalues(self.cluster_topology.brokers),
          ))
          if under_brokers:
              skip_brokers, skip_partitions = [], []
              for broker in under_brokers:
                  skip_brokers.append(broker)
                  broker.request_leadership(opt_cnt, skip_brokers, skip_partitions)
  
          over_brokers = list(filter(
              lambda b: b.count_preferred_replica() > opt_cnt + 1,
              six.itervalues(self.cluster_topology.brokers),
          ))
          # Any over-balanced brokers tries to donate their leadership to followers
          if over_brokers:
              skip_brokers, used_edges = [], []
              for broker in over_brokers:
                  skip_brokers.append(broker)
                  broker.donate_leadership(opt_cnt, skip_brokers, used_edges)
docs: Transfer leadership to any under-balanced followers on the pretext
          that they remain leader-balanced or can be recursively balanced through
          non-followers (followers of other leaders).
  
          Context:
          Consider a graph G:
          Nodes: Brokers (e.g. b1, b2, b3)
          Edges: From b1 to b2 s.t. b1 is a leader and b2 is its follower
          State of nodes:
              1. Over-balanced/Optimally-balanced: (OB)
                  if leadership-count(broker) >= opt-count
              2. Under-balanced (UB) if leadership-count(broker) < opt-count
              leader-balanced: leadership-count(broker) is in [opt-count, opt-count+1]
  
          Algorithm:
              1. Use Depth-first-search algorithm to find path between
              between some UB-broker to some OB-broker.
              2. If path found, update UB-broker and delete path-edges (skip-partitions).
              3. Continue with step-1 until all possible paths explored.