def render(self, request):
        """
        Do various things to conform to the CGI specification.

        I will set up the usual slew of environment variables, then spin off a
        process.

        @type request: L{twisted.web.http.Request}
        @param request: An HTTP request.
        """
        scriptName = b"/" + b"/".join(request.prepath)
        serverName = request.getRequestHostname().split(b':')[0]
        env = {"SERVER_SOFTWARE":   server.version,
               "SERVER_NAME":       serverName,
               "GATEWAY_INTERFACE": "CGI/1.1",
               "SERVER_PROTOCOL":   request.clientproto,
               "SERVER_PORT":       str(request.getHost().port),
               "REQUEST_METHOD":    request.method,
               "SCRIPT_NAME":       scriptName,
               "SCRIPT_FILENAME":   self.filename,
               "REQUEST_URI":       request.uri}

        ip = request.getClientAddress().host
        if ip is not None:
            env['REMOTE_ADDR'] = ip
        pp = request.postpath
        if pp:
            env["PATH_INFO"] = "/" + "/".join(pp)

        if hasattr(request, "content"):
            # 'request.content' is either a StringIO or a TemporaryFile, and
            # the file pointer is sitting at the beginning (seek(0,0))
            request.content.seek(0, 2)
            length = request.content.tell()
            request.content.seek(0, 0)
            env['CONTENT_LENGTH'] = str(length)

        try:
            qindex = request.uri.index(b'?')
        except ValueError:
            env['QUERY_STRING'] = ''
            qargs = []
        else:
            qs = env['QUERY_STRING'] = request.uri[qindex+1:]
            if '=' in qs:
                qargs = []
            else:
                qargs = [urllib.unquote(x) for x in qs.split('+')]

        # Propagate HTTP headers
        for title, header in request.getAllHeaders().items():
            envname = title.replace(b'-', b'_').upper()
            if title not in (b'content-type', b'content-length', b'proxy'):
                envname = b"HTTP_" + envname
            env[envname] = header
        # Propagate our environment
        for key, value in os.environ.items():
            if key not in env:
                env[key] = value
        # And they're off!
        self.runProcess(env, request, qargs)
        return server.NOT_DONE_YET

        Do various things to conform to the CGI specification.

        I will set up the usual slew of environment variables, then spin off a
        process.

        @type request: L{twisted.web.http.Request}
        @param request: An HTTP request.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/twcgi.py