human
I wrote the below code

    @wraps(method)
    def _wrapper(self, *args, **kwargs):
        if ('_memoized_results' not in self.__dict__):
            self._memoized_results = {}
        memoized_results = self._memoized_results
        key = (method.__name__, args, tuple(sorted(kwargs.items())))
        if (key in memoized_results):
            return memoized_results[key]
        else:
            try:
                result = method(self, *args, **kwargs)
            except KeyError as e:
                if ('__wrapped__' in str(e)):
                    result = None
                else:
                    raise
            if (isinstance(result, GeneratorType) or (not isinstance(result, Hashable))):
                raise TypeError("Can't    memoize    a    generator    or    non-hashable    object!")
            return memoized_results.setdefault(key, result)
    return _wrapper

What's a good function header?
 ... Here's a good function header?
assistant
#Here's a good function header.

def memoizemethod(method):