@contextmanager
def ctime(message=None):
    t = time.time()
    yield
    if message:
        print message + ":\t",
    print round(time.time() - t, 4), "sec"
Counts the time spent in some context
dataset/ETHPy150Open visualfabriq/bquery/bquery/benchmarks/bench_pos.py/ctime