class_docstr: Converts a `tornado.web.Application` instance into a WSGI application.
  
  Example usage::
  
      import tornado.web
      import tornado.wsgi
      import wsgiref.simple_server
  
      class MainHandler(tornado.web.RequestHandler):
          def get(self):
              self.write("Hello, world")
  
      if __name__ == "__main__":
          application = tornado.web.Application([
              (r"/", MainHandler),
          ])
          wsgi_app = tornado.wsgi.WSGIAdapter(application)
          server = wsgiref.simple_server.make_server('', 8888, wsgi_app)
          server.serve_forever()
  
  See the `appengine demo
  <https://github.com/tornadoweb/tornado/tree/stable/demos/appengine>`_
  for an example of using this module to run a Tornado app on Google
  App Engine.
  
  In WSGI mode asynchronous methods are not supported.  This means
  that it is not possible to use `.AsyncHTTPClient`, or the
  `tornado.auth` or `tornado.websocket` modules.
  
  .. versionadded:: 4.0
class_docstr_tok: ["Converts","a","`","tornado.web.Application","`","instance","into","a","WSGI","application",".","Example","usage",":",":","import","tornado.web","import","tornado.wsgi","import","wsgiref.simple_server","class","MainHandler","(","tornado.web.RequestHandler",")",":","def","get","(","self",")",":","self.write","(","``","Hello",",","world","''",")","if","__name__","==","``","__main__","''",":","application","=","tornado.web.Application","(","[","(","r","''","\/","''",",","MainHandler",")",",","]",")","wsgi_app","=","tornado.wsgi.WSGIAdapter","(","application",")","server","=","wsgiref.simple_server.make_server","(","``",",","8888",",","wsgi_app",")","server.serve_forever","(",")","See","the","`","appengine","demo","<","https",":","\/\/github.com\/tornadoweb\/tornado\/tree\/stable\/demos\/appengine",">","`","_","for","an","example","of","using","this","module","to","run","a","Tornado","app","on","Google","App","Engine",".","In","WSGI","mode","asynchronous","methods","are","not","supported",".","This","means","that","it","is","not","possible","to","use","`",".AsyncHTTPClient","`",",","or","the","`","tornado.auth","`","or","`","tornado.websocket","`","modules",".","..","versionadded",":",":","4.0"]
code: def __call__(self, environ, start_response):
      method = environ["REQUEST_METHOD"]
      uri = urllib_parse.quote(
          from_wsgi_str(environ.get("SCRIPT_NAME", ""))
      )
      uri += urllib_parse.quote(
          from_wsgi_str(environ.get("PATH_INFO", ""))
      )
      if environ.get("QUERY_STRING"):
          uri += "?" + environ["QUERY_STRING"]
      headers = httputil.HTTPHeaders()
      if environ.get("CONTENT_TYPE"):
          headers["Content-Type"] = environ["CONTENT_TYPE"]
      if environ.get("CONTENT_LENGTH"):
          headers["Content-Length"] = environ["CONTENT_LENGTH"]
      for key in environ:
          if key.startswith("HTTP_"):
              headers[key[5:].replace("_", "-")] = environ[key]
      if headers.get("Content-Length"):
          body = environ["wsgi.input"].read(
              int(headers["Content-Length"])
          )
      else:
          body = b""
      protocol = environ["wsgi.url_scheme"]
      remote_ip = environ.get("REMOTE_ADDR", "")
      if environ.get("HTTP_HOST"):
          host = environ["HTTP_HOST"]
      else:
          host = environ["SERVER_NAME"]
      connection = _WSGIConnection(
          method,
          start_response,
          _WSGIRequestContext(remote_ip, protocol),
      )
      request = httputil.HTTPServerRequest(
          method,
          uri,
          "HTTP/1.1",
          headers=headers,
          body=body,
          host=host,
          connection=connection,
      )
      request._parse_body()
      self.application(request)
      if connection._error:
          raise connection._error
      if not connection._finished:
          raise Exception("request did not finish synchronously")
      return connection._write_buffer
  
imports: from __future__ import absolute_import, division, print_function
  import sys
  from io import BytesIO
  import tornado
  from tornado.concurrent import Future
  from tornado import escape
  from tornado import httputil
  from tornado.log import access_log
  from tornado import web
  from tornado.escape import native_str
  from tornado.util import unicode_type, PY3
label_desc: Use image node_id 2 for calling the WSGIAdapter obj's underlying member method code with example usage: obj.__call__(environ, start_response) and returns: connection