code: def timeit(func):
      
      import time
  
      def timed(*args, **kw):
          ts = time.time()
          result = func(*args, **kw)
          te = time.time()
  
          msg = "{0}{1} {2:.2f}s".format(func.__name__, args, te - ts)
          logging.debug(msg)
  
          return result
  
      return timed
docs: <http://www.zopyx.com/blog/a-python-decorator-for-measuring-the-execution-time-of-methods>