def __setslice__(self, start, end, value):
        "set bits slice from start to end index (n-0) with the given value"
        mask = 2**(end - start + 1) -1
        value = (value & mask) << start
        mask = mask << start
        self._d = (self._d & ~mask) | value
        return (self._d >> start) & mask
set bits slice from start to end index (n-0) with the given value
recipes/Python/578922_bitfield_rev2/recipe-578922.py