Save the cache to `self`

        This decorator take it for granted that the decorated function
        is a method.  The first argument of the function is `self`.

        :param func: function to decorate
        :return: the decorator

def instance_cache(cls, func):
        """ Save the cache to `self`

        This decorator take it for granted that the decorated function
        is a method.  The first argument of the function is `self`.

        :param func: function to decorate
        :return: the decorator
        """

        @functools.wraps(func)
        def func_wrapper(*args, **kwargs):
            if not args:
                raise ValueError('`self` is not available.')
            else:
                the_self = args[0]
            func_key = cls.get_key(func)
            val_cache = cls.get_self_cache(the_self, func_key)
            lock = cls.get_self_cache_lock(the_self, func_key)

            return cls._get_value_from_cache(
                func, val_cache, lock, *args, **kwargs)

        return func_wrapper