def __setitem__(self, index, value):
        if not self.__is_value_array:
            raise ValueError("Report item is not value usage array")
        if index < self.__report_count:
            byte_index = int( (index * self.__bit_size) // 8 )
            bit_index  = (index * self.__bit_size) % 8
            bit_mask = ((1 << self.__bit_size) - 1)
            self.__value[byte_index] &= ~(bit_mask << bit_index)
            self.__value[byte_index] |= (value & bit_mask) << bit_index
        else:
            raise IndexError
Allow to access value array by index
dataset/ETHPy150Open rene-aguirre/pywinusb/pywinusb/hid/core.py/ReportItem.__setitem__