def METHOD_NAME(func):
    cache = LRUCache(maxsize=maxsize)
    # the actual decorated function:
    @wraps(func)
    def cached(*args, **kwargs):
        cache_key = key_func(*args, **kwargs)
        if cache_key in cache:
            # cache hit
            return cache[cache_key]
        else:
            # cache miss, call function and cache result
            result = func(*args, **kwargs)
            if isinstance(result, DoNotCache):
                # DoNotCache prevents caching
                result = result.result
            else:
                cache[cache_key] = result
        return result
    return cached