def METHOD_NAME(response):
    content_type = response.headers.get("Content-Type")
    if not content_type:
        return
    content_type = content_type.split(";")[0].strip()
    extension = mimetypes.guess_extension(content_type)
    ext_whitelist = (
        ".png",
        ".jpg",
        ".gif",
        ".jpeg",
    )
    if extension in ext_whitelist:
        return content_type, extension
    return None, None