Cache a python function with lru_cache