<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cache_result(default_size=settings.AVATAR_DEFAULT_SIZE):
 """ Decorator to cache the result of functions that take a ``user`` and a ``size`` value. """

    if not settings.AVATAR_CACHE_ENABLED:
        def decorator(func):
            return func
        return decorator

    def decorator(func):
        def cached_func(user, size=None, **kwargs):
            prefix = func.__name__
            cached_funcs.add(prefix)
            key = get_cache_key(user, size or default_size, prefix=prefix)
            result = cache.get(key)
            if result is None:
                result = func(user, size or default_size, **kwargs)
                cache_set(key, result)
            return result
        return cached_func
    return decorator