code: def set_bool(_bytearray, byte_index, bool_index, value):
      
      assert value in [0, 1, True, False]
      current_value = get_bool(_bytearray, byte_index, bool_index)
      index_value = 1 << bool_index
  
      # check if bool already has correct value
      if current_value == value:
          return
  
      if value:
          # make sure index_v is IN current byte
          _bytearray[byte_index] += index_value
      else:
          # make sure index_v is NOT in current byte
          _bytearray[byte_index] -= index_value
docs: Set boolean value on location in bytearray