Sometimes we might want to run some code at the beginning and at end of a function. For example, the time()
function can help us measure the number of elapsed seconds while executing a code block.
While effective, we would have to wrap any function/code we want to measure with time.time()
statements. We can avoid such repetition using decorators and implement the same in a much cleaner way.