code: def timer(name, count):
      '''Time this block.'''
      start = time.time()
      try:
          yield count
      finally:
          duration = time.time() - start
          print(name)
          print('=' * 10)
          print('Total: %s' % duration)
          print('  Avg: %s' % (duration / count))
          print(' Rate: %s' % (count / duration))
          print(''f timer(name, count):
      '''Time this block.'''
      start = time.time()
      try:
          yield count
      finally:
          duration = time.time() - start
          print(name)
          print('=' * 10)
          print('Total: %s' % duration)
          print('  Avg: %s' % (duration / count))
          print(' Rate: %s' % (count / duration))
          print('')
docs: Time this block.