def __call__(self, *args, **kwargs):
    key = self.key(args, kwargs)
if key not in self.cache:
    self.cache[key] = self.func(*args, **kwargs)
return self.cache[key]

def normalize_args(self, args, kwargs):
    spec = inspect.getargs(self.func.__code__).args
return dict(list(kwargs.items()) + zip(spec, args))

def key(self, args, kwargs):
    a = self.normalize_args(args, kwargs)
return tuple(sorted(a.items()))
Is there a pythonic way to support keyword arguments for a memoize decorator in Python?