code: def cleanup(self):
          
  
          while self.inactive_timeout > 0:
              self.time = time.time()
  
              keys = []
  
              for key, client in self.clients.items.items():
                  t = getattr(client, "active_at", 0)
                  if t > 0 and self.time - t > self.inactive_timeout:
                      client.kwargs["link"].disconnect()
                      keys.append(key)
  
              for key in keys:
                  self.log_debug("Removing client (inactive): %s" % key)
                  del self.clients[key]
  
              time.sleep(1)
docs: removes inactive clients (will be run in its own thread, about once
          every second)