#NEWLINE# def is_safe_url( url , host = None ) : #NEWLINE# #INDENT# "Return ``True`` if the url is a safe redirection.\n\n    The safe redirection means that it doesn't point to a different host.\n    Always returns ``False`` on an empty url.\n    " #NEWLINE# if ( not url ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# netloc = urlparse . urlparse ( url ) [ 1 ] #NEWLINE# return ( ( not netloc ) or ( netloc == host ) )