code: def get_host(self, use_x_forwarded=True):
          
          # We try three options, in order of decreasing preference.
          if use_x_forwarded and ('HTTP_X_FORWARDED_HOST' in self.environ):
              host = self.environ['HTTP_X_FORWARDED_HOST']
              port = self.environ.get('HTTP_X_FORWARDED_PORT')
              if port and port != ('443' if self.is_secure else '80'):
                  host = '%s:%s' % (host, port)
              return host
          elif 'HTTP_HOST' in self.environ:
              host = self.environ['HTTP_HOST']
          else:
              # Reconstruct the host using the algorithm from PEP 333.
              host = self.environ['SERVER_NAME']
              server_port = str(self.environ['SERVER_PORT'])
              if server_port != ('443' if self.is_secure else '80'):
                  host = '%s:%s' % (host, server_port)
          return host
docs: Returns the HTTP host using the environment or request headers.