@contextmanager
def collect_profile(file_prefix):
 import cProfile
 import uuid
 profiler = cProfile.Profile()
 profiler.enable()
 try:
  (yield)
 finally:
  profiler.disable()
  profiler.dump_stats('{0}_{1}_master.profile'.format(file_prefix, uuid.uuid4()))

@ contextmanager def collect_profile ( file_prefix ) : import cProfile import uuid profiler = cProfile . Profile ( ) profiler . enable ( ) try : ( yield ) finally : profiler . disable ( ) profiler . dump_stats ( '{0}_{1}_master.profile' . format ( file_prefix , uuid . uuid4 ( ) ) )
context manager to collect profile information .