Python implementation of LRU cache