'Cooperatively rebalances all component ring builders.
This method does not change the state of the composite ring; a
subsequent call to :meth:`compose` is required to generate updated
composite :class:`RingData`.
:return: A list of dicts, one per component builder, each having the
following keys:
* \'builder_file\' maps to the component builder file;
* \'builder\' maps to the corresponding instance of
:class:`swift.common.ring.builder.RingBuilder`;
* \'result\' maps to the results of the rebalance of that component
i.e. a tuple of: `(number_of_partitions_altered,
resulting_balance, number_of_removed_devices)`
The list has the same order as components in the composite ring.
:raises RingBuilderError: if there is an error while rebalancing any
component builder.'

def rebalance(self):

    self._load_components()
    component_builders = zip(self._builder_files, self._builders)
    shuffle(component_builders)
    results = {}
    for (builder_file, builder) in component_builders:
        try:
            results[builder] = {'builder': builder, 'builder_file': builder_file, 'result': builder.rebalance()}
            builder.validate()
        except RingBuilderError as err:
            self._builders = None
            raise RingBuilderError(('An    error    occurred    while    rebalancing    component    %s:    %s' % (builder_file, err)))
    for (builder_file, builder) in component_builders:
        builder.save(builder_file)
    return [results[builder] for builder in self._builders]
