'Normalize the URL to create a safe key for the cache'

@classmethod
def _urlnorm(cls, uri):

    (scheme, authority, path, query, fragment) = parse_uri(uri)
    if ((not scheme) or (not authority)):
        raise Exception(('Only    absolute    URIs    are    allowed.    uri    =    %s' % uri))
    scheme = scheme.lower()
    authority = authority.lower()
    if (not path):
        path = '/'
    request_uri = ((query and '?'.join([path, query])) or path)
    defrag_uri = (((scheme + '://') + authority) + request_uri)
    return defrag_uri
