def reconstruct_hostname(self, port_override=None):
url = self.server<EOL>port = port_override or self.port<EOL>if port and ((self.url_scheme == '<STR_LIT>' and str(port) != '<STR_LIT>') or<EOL>(self.url_scheme != '<STR_LIT>' and str(port) != '<STR_LIT>')):<EOL><INDENT>url += '<STR_LIT>'.format(port)<EOL><DEDENT>return url<EOL>
Reconstruct the hostname of a request.

        This is based on the URL reconstruction code in Python PEP 333:
        http://www.python.org/dev/peps/pep-0333/#url-reconstruction.  Rebuild the
        hostname from the pieces available in the environment.

        Args:
          port_override: str, An override for the port on the returned hostname.

        Returns:
          The hostname portion of the URL from the request, not including the
          URL scheme.