def callWithLogger(logger, func, *args, **kw):
 try:
  lp = logger.logPrefix()
 except KeyboardInterrupt:
  raise
 except:
  lp = '(buggy logPrefix method)'
  err(system=lp)
 try:
  return callWithContext({'system': lp}, func, *args, **kw)
 except KeyboardInterrupt:
  raise
 except:
  err(system=lp)

def callWithLogger ( logger , func , * args , ** kw ) : try : lp = logger . logPrefix ( ) except KeyboardInterrupt : raise except : lp = '(buggy logPrefix method)' err ( system = lp ) try : return callWithContext ( { 'system' : lp } , func , * args , ** kw ) except KeyboardInterrupt : raise except : err ( system = lp )
utility method which wraps a function in a try:/except: .