code: def display_replica_imbalance(cluster_topologies):
      
      assert cluster_topologies
  
      rg_ids = list(next(six.itervalues(cluster_topologies)).rgs.keys())
      assert all(
          set(rg_ids) == set(cluster_topology.rgs.keys())
          for cluster_topology in six.itervalues(cluster_topologies)
      )
  
      rg_imbalances = [
          stats.get_replication_group_imbalance_stats(
              list(cluster_topology.rgs.values()),
              list(cluster_topology.partitions.values()),
          )
          for cluster_topology in six.itervalues(cluster_topologies)
      ]
  
      _display_table_title_multicolumn(
          'Extra Replica Count',
          'Replication Group',
          rg_ids,
          list(cluster_topologies.keys()),
          [
              [erc[rg_id] for rg_id in rg_ids]
              for _, erc in rg_imbalances
          ],
      )
  
      for name, imbalance in zip(
              six.iterkeys(cluster_topologies),
              (imbalance for imbalance, _ in rg_imbalances)
      ):
          print(
              '\n'
              '{name}'
              'Total extra replica count: {imbalance}'
              .format(
                  name='' if len(cluster_topologies) == 1 else name + '\n',
                  imbalance=imbalance,
              )
          )
docs: Display replica replication-group distribution imbalance statistics.
  
      :param cluster_topologies: A dictionary mapping a string name to a
          ClusterTopology object.