def METHOD_NAME(request, url):
    camo_url = request.registry.settings["camo.url"].format(request=request)
    camo_key = request.registry.settings["camo.key"].encode("utf8")
    url = url.encode("utf8")
    path = "/".join(
        [
            hmac.new(camo_key, url, digestmod="sha1").hexdigest(),
            binascii.hexlify(url).decode("utf8"),
        ]
    )
    return urllib.parse.urljoin(camo_url, path)