code: def get_net_imbalance(count_per_broker):
      
      net_imbalance = 0
      opt_count, extra_allowed = \
          compute_optimum(len(count_per_broker), sum(count_per_broker))
      for count in count_per_broker:
          extra_cnt, extra_allowed = \
              get_extra_element_count(count, opt_count, extra_allowed)
          net_imbalance += extra_cnt
      return net_imbalance
docs: Calculate and return net imbalance based on given count of
      partitions or leaders per broker.
  
      Net-imbalance in case of partitions implies total number of
      extra partitions from optimal count over all brokers.
      This is also implies, the minimum number of partition movements
      required for overall balancing.
  
      For leaders, net imbalance implies total number of extra brokers
      as leaders from optimal count.