<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_dialog_state(handler_input):
 # type: (HandlerInput) -> Optional[DialogState] """Return the dialog state enum from the intent request. The method retrieves the `dialogState` from the intent request, if the skill's interaction model includes a dialog model. This can be used to determine the current status of user conversation and return the appropriate dialog directives if the conversation is not yet complete. More information on dialog management can be found here : https://developer.amazon.com/docs/custom-skills/define-the-dialog-to-collect-and-confirm-required-information.html The method returns a ``None`` if there is no dialog model added or if the intent doesn't have dialog management. The method raises a :py:class:`TypeError` if the input is not an `IntentRequest`. :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 :return: State of the dialog model from the intent request. :rtype: Optional[ask_sdk_model.dialog_state.DialogState] :raises: TypeError if the input is not an IntentRequest """

    request = handler_input.request_envelope.request
    if isinstance(request, IntentRequest):
        return request.dialog_state

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