Changes to caching decorator for Python 3.