Return the slot information from intent request.

    The method retrieves the slot information
    :py:class:`ask_sdk_model.slot.Slot` 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 ``None``
    is returned. 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 that needs to be retrieved
    :type slot_name: str
    :return: Slot information for the provided slot name if it exists,
        or a `None` value
    :rtype: Optional[ask_sdk_model.slot.Slot]
    :raises: TypeError if the input is not an IntentRequest

def get_slot(handler_input, slot_name):
    # type: (HandlerInput, str) -> Optional[Slot]
    """Return the slot information from intent request.

    The method retrieves the slot information
    :py:class:`ask_sdk_model.slot.Slot` 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 ``None``
    is returned. 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 that needs to be retrieved
    :type slot_name: str
    :return: Slot information for the provided slot name if it exists,
        or a `None` value
    :rtype: Optional[ask_sdk_model.slot.Slot]
    :raises: TypeError if the input is not an IntentRequest
    """
    request = handler_input.request_envelope.request
    if isinstance(request, IntentRequest):
        if request.intent.slots is not None:
            return request.intent.slots.get(slot_name, None)
        else:
            return None

    raise TypeError("The provided request is not an IntentRequest")