def escape_url(url):
 url_parsed = compat_urllib_parse_urlparse(url)
 return url_parsed._replace(path=escape_rfc3986(url_parsed.path), params=escape_rfc3986(url_parsed.params), query=escape_rfc3986(url_parsed.query), fragment=escape_rfc3986(url_parsed.fragment)).geturl()

def escape_url ( url ) : url_parsed = compat_urllib_parse_urlparse ( url ) return url_parsed . _replace ( path = escape_rfc3986 ( url_parsed . path ) , params = escape_rfc3986 ( url_parsed . params ) , query = escape_rfc3986 ( url_parsed . query ) , fragment = escape_rfc3986 ( url_parsed . fragment ) ) . geturl ( )
escape url as suggested by rfc 3986 .