def with_cached_html_pages(fn):
    "\n    Given a function that parses an Iterable[Link] from an HTMLPage, cache the\n    function's result (keyed by CacheablePageContent), unless the HTMLPage\n    `page` has `page.cache_link_parsing == False`.\n    "

    @_lru_cache(maxsize=None)
    def wrapper(cacheable_page):
        return list(fn(cacheable_page.page))

    @functools.wraps(fn)
    def wrapper_wrapper(page):
        if page.cache_link_parsing:
            return wrapper(CacheablePageContent(page))
        return list(fn(page))
    return wrapper_wrapper
Given a function that parses an Iterable[Link] from an HTMLPage, cache the
function's result (keyed by CacheablePageContent), unless the HTMLPage
`page` has `page.cache_link_parsing == False`.
def with_cached_html_pages(fn):
    "\n    Given a function that parses an Iterable[Link] from an HTMLPage, cache the\n    function's result (keyed by CacheablePageContent), unless the HTMLPage\n    `page` has `page.cache_link_parsing == False`.\n    "

    @_lru_cache(maxsize=None)
    def wrapper(cacheable_page):
        return list(fn(cacheable_page.page))

    @functools.wraps(fn)
    def wrapper_wrapper(page):
        if page.cache_link_parsing:
            return wrapper(CacheablePageContent(page))
        return list(fn(page))
    return wrapper_wrapper