code: def cleaner(self):
          
          while True:
              self.cleanup()
              now = time.time()
              try:
                  while (time.time() - now) < self.clean_interval:
                      if not self.run_clean_thread:
                          return
                      time.sleep(1)
              except:
                  return
docs: cleaner: method to be run in a thread to check for stale connections.