def _computeHostValue(self, scheme, host, port):
        """
        Compute the string to use for the value of the I{Host} header, based on
        the given scheme, host name, and port number.
        """
        if (isIPv6Address(nativeString(host))):
            host = b'[' + host + b']'
        if (scheme, port) in ((b'http', 80), (b'https', 443)):
            return host
        return host + b":" + intToBytes(port)

        Compute the string to use for the value of the I{Host} header, based on
        the given scheme, host name, and port number.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/client.py