def memoize_traffic(**memoize_kwargs):
 def memoize_traffic_decorator(fn):
  def memoize_traffic_wrapper(cls, *args, **kwargs):
   method = '.'.join((cls.__name__, fn.__name__))
   actual_memoize_decorator = memoize(method, **memoize_kwargs)
   actual_memoize_wrapper = actual_memoize_decorator(fn)
   return actual_memoize_wrapper(cls, *args, **kwargs)
  return memoize_traffic_wrapper
 return memoize_traffic_decorator

def memoize_traffic ( ** memoize_kwargs ) : def memoize_traffic_decorator ( fn ) : def memoize_traffic_wrapper ( cls , * args , ** kwargs ) : method = '.' . join ( ( cls . __name__ , fn . __name__ ) ) actual_memoize_decorator = memoize ( method , ** memoize_kwargs ) actual_memoize_wrapper = actual_memoize_decorator ( fn ) return actual_memoize_wrapper ( cls , * args , ** kwargs ) return memoize_traffic_wrapper return memoize_traffic_decorator
wrap the memoize decorator and automatically determine memoize key .