code: def get_self_host(request_data):
          
          if 'http_host' in request_data:
              current_host = request_data['http_host']
          elif 'server_name' in request_data:
              current_host = request_data['server_name']
          else:
              raise Exception('No hostname defined')
  
          if ':' in current_host:
              current_host_data = current_host.split(':')
              possible_port = current_host_data[-1]
              try:
                  possible_port = float(possible_port)
                  current_host = current_host_data[0]
              except ValueError:
                  current_host = ':'.join(current_host_data)
  
          return current_host
docs: Returns the current host.
  
          :param request_data: The request as a dict
          :type: dict
  
          :return: The current host
          :rtype: string