'Set the specified fields to the supplied values.
Arguments:
kv_dict (dict): A dictionary mapping :class:`~DjangoKeyValueStore.Key`
objects to values to set.'

@contract(kv_dict='dict(DjangoKeyValueStore_Key:    *)')
def set_many(self, kv_dict):

    pending_updates = defaultdict(dict)
    for (kvs_key, value) in kv_dict.items():
        cache_key = self._cache_key_for_kvs_key(kvs_key)
        pending_updates[cache_key][kvs_key.field_name] = value
    try:
        self._client.set_many(self.user.username, pending_updates)
    except DatabaseError:
        log.exception('Saving    user    state    failed    for    %s', self.user.username)
        raise KeyValueMultiSaveError([])
    finally:
        self._cache.update(pending_updates)
