def if_search_enabled(f):
 @wraps(f)
 def wrapper(*args, **kwargs):
  'Wraps the decorated function.'
  cls = args[0]
  if cls.search_is_enabled():
   return f(*args, **kwargs)
 return wrapper

def if_search_enabled ( f ) : @ wraps ( f ) def wrapper ( * args , ** kwargs ) : cls = args [ 0 ] if cls . search_is_enabled ( ) : return f ( * args , ** kwargs ) return wrapper
only call f if search is enabled for the courseteamindexer .