code: def safe_filter(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
docs: A safe filter decorator only raising errors when ``THUMBNAIL_DEBUG`` is
      ``True`` otherwise returning ``error_output``.