def METHOD_NAME(self, request, response):
    """
    This custom middleware is written to mitigate broken links from IOGT v1.
    See https://github.com/unicef/iogt/issues/850 for more details.
    """
    return_value = super().METHOD_NAME(request, response)
    # If the page is not found by wagtail RedirectMiddleware, look for the page in V1PageURLToV2PageMap.
    # If you find the page, redirect the user to the new page.
    if return_value.status_code == 404:
        url = unquote(request.get_full_path())
        page = V1PageURLToV2PageMap.get_page_or_none(url)
        if page:
            return HttpResponsePermanentRedirect(page.url)
    return return_value