def _request_handler(self, **kwargs):
route = self._get_current_route(request)<EOL>try:<EOL><INDENT>event = self._construct_event(request, self.port, route.binary_types)<EOL><DEDENT>except UnicodeDecodeError:<EOL><INDENT>return ServiceErrorResponses.lambda_failure_response()<EOL><DEDENT>stdout_stream = io.BytesIO()<EOL>stdout_stream_writer = StreamWriter(stdout_stream, self.is_debugging)<EOL>try:<EOL><INDENT>self.lambda_runner.invoke(route.function_name, event, stdout=stdout_stream_writer, stderr=self.stderr)<EOL><DEDENT>except FunctionNotFound:<EOL><INDENT>return ServiceErrorResponses.lambda_not_found_response()<EOL><DEDENT>lambda_response, lambda_logs, _ = LambdaOutputParser.get_lambda_output(stdout_stream)<EOL>if self.stderr and lambda_logs:<EOL><INDENT>self.stderr.write(lambda_logs)<EOL><DEDENT>try:<EOL><INDENT>(status_code, headers, body) = self._parse_lambda_output(lambda_response,<EOL>route.binary_types,<EOL>request)<EOL><DEDENT>except (KeyError, TypeError, ValueError):<EOL><INDENT>LOG.error("<STR_LIT>"<EOL>"<STR_LIT>", lambda_response)<EOL>return ServiceErrorResponses.lambda_failure_response()<EOL><DEDENT>return self.service_response(body, headers, status_code)<EOL>
We handle all requests to the host:port. The general flow of handling a request is as follows

* Fetch request from the Flask Global state. This is where Flask places the request and is per thread so
  multiple requests are still handled correctly
* Find the Lambda function to invoke by doing a look up based on the request.endpoint and method
* If we don't find the function, we will throw a 502 (just like the 404 and 405 responses we get
  from Flask.
* Since we found a Lambda function to invoke, we construct the Lambda Event from the request
* Then Invoke the Lambda function (docker container)
* We then transform the response or errors we get from the Invoke and return the data back to
  the caller

Parameters
----------
kwargs dict
    Keyword Args that are passed to the function from Flask. This happens when we have path parameters

Returns
-------
Response object