'Check dead connections and see if any timeouts have expired'

def cleanup_dead(self):

    if (not self.dead_connections):
        return
    now = time()
    for (conn, timeout) in self.dead_connections[:]:
        if (timeout > now):
            return
        with self._lock:
            try:
                self.dead_connections.remove((conn, timeout))
            except ValueError:
                pass
            else:
                self.connections.append(conn)
