code: def timed_operation(msg, log_start=False):
      
      assert len(msg)
      if log_start:
          logger.info('Start {} ...'.format(msg))
      start = timer()
      yield
      msg = msg[0].upper() + msg[1:]
      logger.info('{} finished, time:{:.4f} sec.'.format(
          msg, timer() - start))
docs: Surround a context with a timer.
  
      Args:
          msg(str): the log to print.
          log_start(bool): whether to print also at the beginning.
  
      Example:
          .. code-block:: python
  
              with timed_operation('Good Stuff'):
                  time.sleep(1)
  
          Will print:
  
          .. code-block:: python
  
              Good stuff finished, time:1sec.