def is_same_domain(host, pattern):
 if (not pattern):
  return False
 pattern = pattern.lower()
 return (((pattern[0] == '.') and (host.endswith(pattern) or (host == pattern[1:]))) or (pattern == host))

def is_same_domain ( host , pattern ) : if ( not pattern ) : return False pattern = pattern . lower ( ) return ( ( ( pattern [ 0 ] == '.' ) and ( host . endswith ( pattern ) or ( host == pattern [ 1 : ] ) ) ) or ( pattern == host ) )
return true if the host is either an exact match or a match to the wildcard pattern .