def same_origin(url1, url2):
 (p1, p2) = (urllib_parse.urlparse(url1), urllib_parse.urlparse(url2))
 return ((p1.scheme, p1.hostname, p1.port) == (p2.scheme, p2.hostname, p2.port))

def same_origin ( url1 , url2 ) : ( p1 , p2 ) = ( urllib_parse . urlparse ( url1 ) , urllib_parse . urlparse ( url2 ) ) return ( ( p1 . scheme , p1 . hostname , p1 . port ) == ( p2 . scheme , p2 . hostname , p2 . port ) )
checks if two urls are same-origin .