code: def make_update_loop(thread, update_func):
      
      while not thread.should_stop():
          if thread.should_pause():
              thread.wait_to_resume()
  
          start = time.time()
          if hasattr(thread, '_updated'):
              thread._updated.clear()
          update_func()
          if hasattr(thread, '_updated'):
              thread._updated.set()
          end = time.time()
  
          dt = thread.period - (end - start)
  
          if dt > 0:
              time.sleep(dt)
docs: Makes a run loop which calls an update function at a predefined frequency.