'Set the weight of a device. This should be called rather than just
altering the weight key in the device dict directly, as the builder
will need to rebuild some internal state to reflect the change.
.. note::
This will not rebalance the ring immediately as you may want to
make multiple changes for a single rebalance.
:param dev_id: device id
:param weight: new weight for device'

def set_dev_weight(self, dev_id, weight):

    if any(((dev_id == d['id']) for d in self._remove_devs)):
        raise ValueError(('Can    not    set    weight    of    dev_id    %s    because    it    is    marked    for    removal' % (dev_id,)))
    self.devs[dev_id]['weight'] = weight
    self.devs_changed = True
    self.version += 1
