def ServeApp(self, app, mod_file, env, start_response):
    """(Further) wrap the provided WSGI app and dispatch a request to it."""




    for key in ENV_KEYS:
      if key in os.environ:
        del os.environ[key]
    for key in ENV_KEYS:
      assert key not in os.environ
      assert os.getenv(key) is None
    for key in self.user_env_variables:
      if key not in os.environ:
        os.environ[key] = self.user_env_variables[key]
    os.environ['AUTH_DOMAIN'] = 'gmail.com'
    os.environ['USER_IS_ADMIN'] = '0'
    for key in ENV_KEYS:
      value = env.get('HTTP_X_APPENGINE_' + key)
      if value:
        os.environ[key] = value
      elif key not in os.environ:
        os.environ[key] = ''






    user_ip = os.environ.get(WSGI_REMOTE_ADDR_ENV_KEY)
    if not user_ip:


      user_ip = env.get(X_APPENGINE_USER_IP_ENV_KEY)

    if user_ip:



      env[WSGI_REMOTE_ADDR_ENV_KEY] = user_ip


      os.environ[WSGI_REMOTE_ADDR_ENV_KEY] = user_ip



    os.environ['PATH_TRANSLATED'] = mod_file


    try:
      import appengine_config
      add_middleware = appengine_config.webapp_add_wsgi_middleware
    except (ImportError, __HOLE__):
      pass
    else:
      try:
        app = add_middleware(app)
      except Exception:
        logging.exception('Failure adding WSGI middleware')


    return app(env, start_response)
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/ext/vmruntime/meta_app.py/MetaWSGIApp.ServeApp