<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def safe_filter(error_output=''):
 """ A safe filter decorator only raising errors when ``THUMBNAIL_DEBUG`` is ``True`` otherwise returning ``error_output``. """


    def inner(f):
        @wraps(f)
        def wrapper(*args, **kwargs):
            try:
                return f(*args, **kwargs)
            except Exception as err:
                if sorl_settings.THUMBNAIL_DEBUG:
                    raise
                logger.error('Thumbnail filter failed: %s' % str(err),
                             exc_info=sys.exc_info())
                return error_output

        return wrapper

    return inner