def print_duration(method):
 def timed(*args, **kw):
  ts = time.time()
  result = method(*args, **kw)
  te = time.time()
  print ('%r %2.2f sec' % (method.__name__, (te - ts)))
  return result
 return timed

def print_duration ( method ) : def timed ( * args , ** kw ) : ts = time . time ( ) result = method ( * args , ** kw ) te = time . time ( ) print ( '%r %2.2f sec' % ( method . __name__ , ( te - ts ) ) ) return result return timed
prints out the runtime duration of a method in seconds .