Context manager to measure execution time of a block

    :arg function metric: f(name, 1, time)
    :arg str name: name for the metric
    :arg int count: user-supplied number of items, defaults to 1

def block(*, name = None, metric = call_default, count = 1):
    """Context manager to measure execution time of a block

    :arg function metric: f(name, 1, time)
    :arg str name: name for the metric
    :arg int count: user-supplied number of items, defaults to 1
    """
    t = time.time()
    try:
        yield
    finally:
        metric(name, count, time.time() - t)