def METHOD_NAME(request, response):
    data = {
        "status_code": response.status_code,
        "content_type": response.headers.get("Content-Type"),
    }
    if request:
        data["url"] = request.url
    try:
        data["json"] = response.json()
    except (AttributeError, ValueError):
        pass
    if data.get("json") is None:
        try:
            data["text"] = response.text[:5000]
        except Exception:  # pylint: disable=broad-except
            # Use super broad exceptions so we can't fail here
            data["text"] = "... cannot retrieve ..."
    return data