def instantiate_descriptor(server, uuid, initial_value=None, fixed_size=True, max_length=None):
    """
    Instantiate the service with the descriptor under test.
    Return the handle of the descriptor under test.
    """
    gatt_server = server.gattServer

    gatt_server.declareService(0xFFFB)
    gatt_server.declareCharacteristic(0xDEAF)
    gatt_server.setCharacteristicProperties("notify", "indicate")
    gatt_server.declareDescriptor(uuid)
    if initial_value is not None:
        gatt_server.setDescriptorValue(initial_value)
    gatt_server.setDescriptorVariableLength(not fixed_size)
    if max_length is not None:
        gatt_server.setDescriptorMaxLength(max_length)
    declared_service = gatt_server.commitService().result

    if initial_value is not None:
        assert initial_value == declared_service["characteristics"][0]["descriptors"][0]["value"]

    return declared_service["characteristics"][0]["descriptors"][0]["handle"]