def is_safe_url(url, host=None):
 if (not url):
  return False
 netloc = urlparse.urlparse(url)[1]
 return ((not netloc) or (netloc == host))

def is_safe_url ( url , host = None ) : if ( not url ) : return False netloc = urlparse . urlparse ( url ) [ 1 ] return ( ( not netloc ) or ( netloc == host ) )
return true if the url is a safe redirection .