title: Python: Run code every n seconds and restart timer on condition
body: <p>This may be simpler than I think but I'd like to create timer that, upon reaching a limit (say 15 mins), some code is executed. </p>
  
  <p>Meanwhile every second, I'd like to test for a condition. If the condition is met, then the timer is reset and the process begins again, otherwise the countdown continues.</p>
  
  <p>If the condition is met after the countdown has reached the end, some code is executed and the timer starts counting down again.</p>
  
  <p>Does this involve <code>threading</code> or can it be achieved with a simple <code>time.sleep()</code> function?</p>