decorator pattern every system is differentbut you should get result shaped like the one here[time elapsed for - fibonacci number for we now extend our fibonacci code so we can request the number of elements in the fibonacci sequence we wish to retrieve we do this by encapsulating the fibonacci calculation in function fib_ function py import time def fib( )start_time time time(if return fibprev fib for num in range( )fibprevfib fibfib fibprev end_time time time(print("[time elapsed for {}{}format(nend_time start_time)return fib if __name__ ="__main__" print("fibonacci number for {}{}format(nfib( ))in the preceding codethe profiling takes place outside of the function itself this is fine when you only want to look at single functionbut this is not usually the case when you are optimizing program luckilyfunctions are first-class citizens in pythonand as such we can pass the function as parameter to another function solet' create function to time the execution of another function