@contextlib.contextmanager
def record_time(times, enabled, *args):
 if (not enabled):
  (yield)
 else:
  start = time.time()
  (yield)
  end = time.time()
  times.append((' '.join(args), start, end))

@ contextlib . contextmanager def record_time ( times , enabled , * args ) : if ( not enabled ) : ( yield ) else : start = time . time ( ) ( yield ) end = time . time ( ) times . append ( ( ' ' . join ( args ) , start , end ) )
record the time of a specific action .