Return the slot value from intent request.

    The method retrieves the slot value from the input intent request
    for the given ``slot_name``. More information on the slots can be
    found here :
    https://developer.amazon.com/docs/custom-skills/request-types-reference.html#slot-object

    If there is no such slot, then a :py:class:`ValueError` is raised.
    If the input request is not an
    :py:class:`ask_sdk_model.intent_request.IntentRequest`, a
    :py:class:`TypeError` is raised.

    :param handler_input: The handler input instance that is generally
        passed in the sdk's request and exception components
    :type handler_input: ask_sdk_core.handler_input.HandlerInput
    :param slot_name: Name of the slot for which the value has to be retrieved
    :type slot_name: str
    :return: Slot value for the provided slot if it exists
    :rtype: str
    :raises: TypeError if the input is not an IntentRequest. ValueError is
        slot doesn't exist

def get_slot_value(handler_input, slot_name):
    # type: (HandlerInput, str) -> AnyStr
    """Return the slot value from intent request.

    The method retrieves the slot value from the input intent request
    for the given ``slot_name``. More information on the slots can be
    found here :
    https://developer.amazon.com/docs/custom-skills/request-types-reference.html#slot-object

    If there is no such slot, then a :py:class:`ValueError` is raised.
    If the input request is not an
    :py:class:`ask_sdk_model.intent_request.IntentRequest`, a
    :py:class:`TypeError` is raised.

    :param handler_input: The handler input instance that is generally
        passed in the sdk's request and exception components
    :type handler_input: ask_sdk_core.handler_input.HandlerInput
    :param slot_name: Name of the slot for which the value has to be retrieved
    :type slot_name: str
    :return: Slot value for the provided slot if it exists
    :rtype: str
    :raises: TypeError if the input is not an IntentRequest. ValueError is
        slot doesn't exist
    """
    slot = get_slot(handler_input=handler_input, slot_name=slot_name)

    if slot is not None:
        return slot.value

    raise ValueError(
        "Provided slot {} doesn't exist in the input request".format(
            slot_name))