'Asynchronously sets the keyspace on all pools.  When all
pools have set all of their connections, `callback` will be
called with a dictionary of all errors that occurred, keyed
by the `Host` that they occurred against.'

def _set_keyspace_for_all_pools(self, keyspace, callback):

    with self._lock:
        self.keyspace = keyspace
        remaining_callbacks = set(self._pools.values())
    errors = {}
    if (not remaining_callbacks):
        callback(errors)
        return
    def pool_finished_setting_keyspace(pool, host_errors):
        remaining_callbacks.remove(pool)
        if host_errors:
            errors[pool.host] = host_errors
        if (not remaining_callbacks):
            callback(host_errors)
    for pool in tuple(self._pools.values()):
        pool._set_keyspace_for_all_conns(keyspace, pool_finished_setting_keyspace)
