It comes from http://code.activestate.com/recipes/578078-py26-and-py30-backport-of-python-33s-lru-cache/ written by Raymond Hettinger and MIT licensed, the backport is derived from lru_cache in the stdlib.