'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):

    saved_fields = []
    for (kvs_key, value) in sorted(kv_dict.items()):
        cache_key = self._cache_key_for_kvs_key(kvs_key)
        field_object = self._cache.get(cache_key)
        try:
            serialized_value = json.dumps(value)
            if (field_object is None):
                field_object = self._create_object(kvs_key, serialized_value)
                field_object.save(force_insert=True)
                self._cache[cache_key] = field_object
            else:
                field_object.value = serialized_value
                field_object.save(force_update=True)
        except DatabaseError:
            log.exception('Saving    field    %r    failed', kvs_key.field_name)
            raise KeyValueMultiSaveError(saved_fields)
        finally:
            saved_fields.append(kvs_key.field_name)
