A context manager to measure the execution time of a piece of code.
Example:
with measure_time() as duration: expensive_function() print(f"execution took {duration()} seconds")