code: def polling_loop(timeout, interval=1):
      
      start_time = time.time()
      iteration = 0
      end_time = start_time + timeout
      while time.time() < end_time:
          yield iteration
          iteration += 1
          time.sleep(interval)
docs: Returns an iterator that returns values until timeout has passed. Timeout is measured from start of iteration.