code: def memoize_single(func):
      
      class memodict_single(dict):
          def __missing__(self, key):
              ret = self[key] = func(key)
              return ret
      return memodict_single().__getitem__
docs: Memoization decorator for a function taking a single argument
  
      References:
          http://code.activestate.com/recipes/578231-fastest-memoization-decorator