python como calcular quanto código de tempo leva

import time

start = time.time()

# the code you want to check here

end = time.time()
print("the code took",end-start,"seconds")
Yair Mizrachi