'Build a map of <device_id> => <balance> where <balance> is a float
representing the percentage difference from the desired amount of
partitions a given device wants and the amount it has.
N.B. this method only considers a device\'s weight and the parts
assigned, not the parts wanted according to the replica plan.'

def _build_balance_per_dev(self):

    weight_of_one_part = self.weight_of_one_part()
    balance_per_dev = {}
    for dev in self._iter_devs():
        if (not dev['weight']):
            if dev['parts']:
                balance = MAX_BALANCE
            else:
                balance = 0
        else:
            balance = (((100.0 * dev['parts']) / (dev['weight'] * weight_of_one_part)) - 100.0)
        balance_per_dev[dev['id']] = balance
    return balance_per_dev
