code: def create_request(self, raw_request, **kwargs):
          
          r = self.request_class()
          for k, v in raw_request.items():
              if k.startswith('HTTP_'):
                  r.set_header(k[5:], v)
              else:
                  r.environ[k] = v
  
          r.method = raw_request['REQUEST_METHOD']
          r.path = raw_request['PATH_INFO']
          r.query = raw_request['QUERY_STRING']
  
          # handle headers not prefixed with http
          for k, t in {'CONTENT_TYPE': None, 'CONTENT_LENGTH': int}.items():
              v = r.environ.pop(k, None)
              if v:
                  r.set_header(k, t(v) if t else v)
  
          if 'wsgi.input' in raw_request:
  
              if "CONTENT_LENGTH" in raw_request and int(r.get_header("CONTENT_LENGTH", 0)) <= 0:
                  r.body_kwargs = {}
  
              else:
                  if r.get_header('transfer-encoding', "").lower().startswith('chunked'):
                      raise IOError("Server does not support chunked requests")
  
                  else:
                      r.body_input = raw_request['wsgi.input']
  
          else:
              r.body_kwargs = {}
  
          return r
docs: create instance of request
  
          raw_request -- the raw request object retrieved from a WSGI server