code: def timethis(label, receiver_fn=None):
      
  
      start = time.time()
      try:
          yield
      finally:
          end = time.time()
          if receiver_fn:
              receiver_fn(label, start, end)
          else:
              print('{}: {} to {} -> {} seconds'.format(label, start, end, end-start))
docs: Times a block of code
      Inspired from David Beazley talk - Generators: The Final Frontier