@classmethod<EOL><INDENT>def _urlnorm(cls, uri):<DEDENT>
(scheme, authority, path, query, fragment) = parse_uri(uri)<EOL>if not scheme or not authority:<EOL><INDENT>raise Exception("<STR_LIT>" % uri)<EOL><DEDENT>scheme = scheme.lower()<EOL>authority = authority.lower()<EOL>if not path:<EOL><INDENT>path = "<STR_LIT:/>"<EOL><DEDENT>request_uri = query and "<STR_LIT:?>".join([path, query]) or path<EOL>defrag_uri = scheme + "<STR_LIT>" + authority + request_uri<EOL>return defrag_uri<EOL>
Normalize the URL to create a safe key for the cache