def write_uint16(data, value, index):
    """ Write 16bit value into data string at index and return new string """
    data = data.decode('utf-8')
    return '{}{:02x}{:02x}{}'.format(data[:index * 4], value & 255, value >>
        8, data[index * 4 + 4:])
