def es_required(fun):
    @wraps(fun)
    def wrapper(*args, **kw):
        if getattr(settings, 'ES_DISABLED', False):
            log.debug('Search disabled for %s.' % fun)
            return

        return fun(*args, es=get_es(), **kw)
    return wrapper
Wrap a callable and return None if ES_DISABLED is False.
dataset/ETHPy150Open mozilla/elasticutils/elasticutils/contrib/django/__init__.py/es_required