'Asynchronously sets the keyspace for all connections.  When all
connections have been set, `callback` will be called with two
arguments: this pool, and a list of any errors that occurred.'

def _set_keyspace_for_all_conns(self, keyspace, callback):

    remaining_callbacks = set(self._connections)
    errors = []
    if (not remaining_callbacks):
        callback(self, errors)
        return
    def connection_finished_setting_keyspace(conn, error):
        self.return_connection(conn)
        remaining_callbacks.remove(conn)
        if error:
            errors.append(error)
        if (not remaining_callbacks):
            callback(self, errors)
    self._keyspace = keyspace
    for conn in self._connections:
        conn.set_keyspace_async(keyspace, connection_finished_setting_keyspace)
