In Python, a context manager is an object that can be used in a with
statement. Here's a context manager that reports the total wall-clock time spent inside a with
block:
import time
class Timer(object):
def __init__(self, msg):
self._msg = msg