def trace_method(f):
 @functools.wraps(f)
 def trace_method_logging_wrapper(*args, **kwargs):
  if TRACE_METHOD:
   return trace(f)(*args, **kwargs)
  return f(*args, **kwargs)
 return trace_method_logging_wrapper

def trace_method ( f ) : @ functools . wraps ( f ) def trace_method_logging_wrapper ( * args , ** kwargs ) : if TRACE_METHOD : return trace ( f ) ( * args , ** kwargs ) return f ( * args , ** kwargs ) return trace_method_logging_wrapper
decorates a function if trace_method is true .