I wrote a Python package for function caching that prevents re-entrant calls.