class_docstr: Keeps track of overall time and split/lap times.
  
  >>> import time
  >>> timer = Timer()
  >>> time.sleep(0.01)
  >>> print("First lap:", timer.split())
  First lap: ...
  >>> time.sleep(0.02)
  >>> print("Second lap:", timer.split())
  Second lap: ...
  >>> print("Overall time:", timer.time())
  Overall time: ...
  
  Can be used as a context manager inside with-statements.
  
  >>> with Timer() as t:
  ...     time.sleep(0.01)
  >>> print("%0.3f seconds" % t.elapsed)
  0... seconds
  
  If initialised with a logger, it can log the elapsed time automatically
  upon exiting the with-statement.
  
  >>> import logging
  >>> log = logging.getLogger("my-fancy-timer-logger")
  >>> configLogger(logger=log, level="DEBUG", format="%(message)s", stream=sys.stdout)
  >>> with Timer(log, 'do something'):
  ...     time.sleep(0.01)
  Took ... to do something
  
  The same Timer instance, holding a reference to a logger, can be reused
  in multiple with-statements, optionally with different messages or levels.
  
  >>> timer = Timer(log)
  >>> with timer():
  ...     time.sleep(0.01)
  elapsed time: ...s
  >>> with timer('redo it', level=logging.INFO):
  ...     time.sleep(0.02)
  Took ... to redo it
  
  It can also be used as a function decorator to log the time elapsed to run
  the decorated function.
  
  >>> @timer()
  ... def test1():
  ...    time.sleep(0.01)
  >>> @timer('run test 2', level=logging.INFO)
  ... def test2():
  ...    time.sleep(0.02)
  >>> test1()
  Took ... to run 'test1'
  >>> test2()
  Took ... to run test 2
docstr: End the current lap. If timer has a logger, log the time elapsed,
  using the format string in self.msg (or the default one).
docstr_tok: ["End","the","current","lap",".","If","timer","has","a","logger",",","log","the","time","elapsed",",","using","the","format","string","in","self.msg","(","or","the","default","one",")","."]
code: def __exit__(self, exc_type, exc_value, traceback):
      """End the current lap. If timer has a logger, log the time elapsed,
      using the format string in self.msg (or the default one).
      """
      time = self.split()
      if self.logger is None or exc_type:
          # if there's no logger attached, or if any exception occurred in
          # the with-statement, exit without logging the time
          return
      message = self.formatTime(self.msg, time)
      # Allow log handlers to see the individual parts to facilitate things
      # like a server accumulating aggregate stats.
      msg_parts = {"msg": self.msg, "time": time}
      self.logger.log(self.level, message, msg_parts)
  
imports: import sys
  import logging
  import timeit
  from functools import wraps
  from collections.abc import Mapping, Callable
  import warnings
  from logging import PercentStyle
label_desc: Use image node_id 7 for calling the Timer obj's underlying member method code with example usage: obj.__exit__(exc_type, exc_value, traceback) without return types