code: def dispatch(self, handler_input):
          # type: (Input) -> Union[Output, None]
          
          try:
              for request_interceptor in self.request_interceptors:
                  request_interceptor.process(handler_input=handler_input)
  
              output = self.__dispatch_request(handler_input)  # type: Union[Output, None]
  
              for response_interceptor in self.response_interceptors:
                  response_interceptor.process(
                      handler_input=handler_input, dispatch_output=output)
  
              return output
          except Exception as e:
              if self.exception_mapper is not None:
                  exception_handler = self.exception_mapper.get_handler(
                      handler_input, e)
                  if exception_handler is None:
                      raise e
                  return exception_handler.handle(handler_input, e)
              else:
                  raise e
docs: Dispatches an incoming request to the appropriate
          request handler and returns the output.
  
          Before running the request on the appropriate request handler,
          dispatcher runs any predefined global request interceptors.
          On successful response returned from request handler, dispatcher
          runs predefined global response interceptors, before returning
          the response.
  
          :param handler_input: generic input to the dispatcher
          :type handler_input: Input
          :return: generic output handled by the handler, optionally
              containing a response
          :rtype: Union[None, Output]
          :raises: :py:class:`ask_sdk_runtime.exceptions.DispatchException`