<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run_aws_lambda(self, event):
 """Invoke the Flask Ask application from an AWS Lambda function handler. Use this method to service AWS Lambda requests from a custom Alexa skill. This method will invoke your Flask application providing a WSGI-compatible environment that wraps the original Alexa event provided to the AWS Lambda handler. Returns the output generated by a Flask Ask application, which should be used as the return value to the AWS Lambda handler function. Example usage: from flask import Flask from flask_ask import Ask, statement app = Flask(__name__) ask = Ask(app, '/') # This function name is what you defined when you create an # AWS Lambda function. By default, AWS calls this function # lambda_handler. def lambda_handler(event, _context):
 return ask.run_aws_lambda(event) @ask.intent('HelloIntent') def hello(firstname):
 speech_text = "Hello %s" % firstname return statement(speech_text).simple_card('Hello', speech_text) """


        # We are guaranteed to be called by AWS as a Lambda function does not
        # expose a public facing interface.
        self.app.config['ASK_VERIFY_REQUESTS'] = False

        # Convert an environment variable to a WSGI "bytes-as-unicode" string
        enc, esc = sys.getfilesystemencoding(), 'surrogateescape'
        def unicode_to_wsgi(u):
            return u.encode(enc, esc).decode('iso-8859-1')

        # Create a WSGI-compatible environ that can be passed to the
        # application. It is loaded with the OS environment variables,
        # mandatory CGI-like variables, as well as the mandatory WSGI
        # variables.
        environ = {k: unicode_to_wsgi(v) for k, v in os.environ.items()}
        environ['REQUEST_METHOD'] = 'POST'
        environ['PATH_INFO'] = '/'
        environ['SERVER_NAME'] = 'AWS-Lambda'
        environ['SERVER_PORT'] = '80'
        environ['SERVER_PROTOCOL'] = 'HTTP/1.0'
        environ['wsgi.version'] = (1, 0)
        environ['wsgi.url_scheme'] = 'http'
        environ['wsgi.errors'] = sys.stderr
        environ['wsgi.multithread'] = False
        environ['wsgi.multiprocess'] = False
        environ['wsgi.run_once'] = True

        # Convert the event provided by the AWS Lambda handler to a JSON
        # string that can be read as the body of a HTTP POST request.
        body = json.dumps(event)
        environ['CONTENT_TYPE'] = 'application/json'
        environ['CONTENT_LENGTH'] = len(body)
        
        PY3 = sys.version_info[0] == 3
        
        if PY3:
            environ['wsgi.input'] = io.StringIO(body)
        else:
            environ['wsgi.input'] = io.BytesIO(body)

        # Start response is a required callback that must be passed when
        # the application is invoked. It is used to set HTTP status and
        # headers. Read the WSGI spec for details (PEP3333).
        headers = []
        def start_response(status, response_headers, _exc_info=None):
            headers[:] = [status, response_headers]

        # Invoke the actual Flask application providing our environment,
        # with our Alexa event as the body of the HTTP request, as well
        # as the callback function above. The result will be an iterator
        # that provides a serialized JSON string for our Alexa response.
        result = self.app(environ, start_response)
        try:
            if not headers:
                raise AssertionError("start_response() not called by WSGI app")

            output = b"".join(result)
            if not headers[0].startswith("2"):
                raise AssertionError("Non-2xx from app: hdrs={}, body={}".format(headers, output))

            # The Lambda handler expects a Python object that can be
            # serialized as JSON, so we need to take the already serialized
            # JSON and deserialize it.
            return json.loads(output)

        finally:
            # Per the WSGI spec, we need to invoke the close method if it
            # is implemented on the result object.
            if hasattr(result, 'close'):
                result.close()