human
Complete this python program:
def cache_result(default_size=settings.AVATAR_DEFAULT_SIZE):
assistant
#Here is the Python program you requested.

    """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