code: def on_loop(notifier, counter):
      
      if counter.count > 4:
          # Loops 5 times then exits.
          sys.stdout.write("Exit\n")
          notifier.stop()
          sys.exit(0)
      else:
          sys.stdout.write("Loop %d\n" % counter.count)
          counter.plusone()
docs: Dummy function called after each event loop, this method only
      ensures the child process eventually exits (after 5 iterations).