This is a backport of functools.lru_cache from Python 3.3 as published at ActiveState.