title: manage early return of event loop with python
body: <p>I have a service running the following loop</p>
  
  <pre><code>while True:
      feedback = f1()
      if check1(feedback):
          break
  
      feedback = f2()
      if check2(feedback):
          break
  
      feedback = f3()
      if check3(feedback):
          break
  
      time.sleep(10)
  
  do_cleanup(feedback)
  </code></pre>
  
  <p>Now I would like to run these feedback checks with different time intervals. One naive way is to move the <code>time.sleep()</code> into the <code>f</code> functions. But that causes blocking. What would be the easiest way to achieve periodic checks with different intervals? Here all the <code>f</code> functions are cheap to run.</p>
  
  <p>The event loop in <code>asyncio</code> sounds like the way to go. But due to my inexperience, I don't know where the <code>check</code> and <code>break</code> logic should go for the event loop. </p>
  
  <p>Or is there any other packages/code patterns to do this kind of monitoring logic?</p>