code: def rebalance_replicas(
              self,
              max_movement_count=None,
              max_movement_size=None,
      ):
          
          movement_count = 0
          movement_size = 0
          for partition in six.itervalues(self.cluster_topology.partitions):
              count, size = self._rebalance_partition_replicas(
                  partition,
                  None if not max_movement_count
                  else max_movement_count - movement_count,
                  None if not max_movement_size
                  else max_movement_size - movement_size,
              )
              movement_count += count
              movement_size += size
  
          return movement_count, movement_size
docs: Balance replicas across replication-groups.
  
          :param max_movement_count: The maximum number of partitions to move.
          :param max_movement_size: The maximum total size of the partitions to move.
  
          :returns: A 2-tuple whose first element is the number of partitions moved
              and whose second element is the total size of the partitions moved.