Would this example not be a bit out of date ? Wouldn't it have been a cleaner way to cache functions results to use functools.lru_cache, or even functools.cache since python 3.9?
Here is the code for AUDIENCE, but it would apply for KEY in the same file too:
https://github.com/googlecodelabs/user-authentication-with-iap/blob/a077882f979562ed78044e1655d32897a903d059/3-HelloVerifiedUser/auth.py#L37C1-L53C1