def compare_domains(urls):
 first_domain = None
 for url in urls:
  try:
   if ((not urlparse.urlparse(url).scheme) and (not url.startswith('/'))):
    url = ('//' + url)
   parsed = urlparse.urlparse(url.lower(), 'http')
   domain = (parsed.scheme, parsed.hostname, parsed.port)
  except ValueError:
   return False
  if (not first_domain):
   first_domain = domain
   continue
  if (first_domain != domain):
   return False
 return True

def compare_domains ( urls ) : first_domain = None for url in urls : try : if ( ( not urlparse . urlparse ( url ) . scheme ) and ( not url . startswith ( '/' ) ) ) : url = ( '//' + url ) parsed = urlparse . urlparse ( url . lower ( ) , 'http' ) domain = ( parsed . scheme , parsed . hostname , parsed . port ) except ValueError : return False if ( not first_domain ) : first_domain = domain continue if ( first_domain != domain ) : return False return True
return true if the domains of the provided urls are the same .