'Insert some new one time keys for a device. Errors if any of the
keys already exist.
Args:
user_id(str): id of user to get keys for
device_id(str): id of device to get keys for
time_now(long): insertion time to record (ms since epoch)
new_keys(iterable[(str, str, str)]: keys to add - each a tuple of
(algorithm, key_id, key json)'

@defer.inlineCallbacks
def add_e2e_one_time_keys(self, user_id, device_id, time_now, new_keys):

    def _add_e2e_one_time_keys(txn):
        self._simple_insert_many_txn(txn, table='e2e_one_time_keys_json', values=[{'user_id': user_id, 'device_id': device_id, 'algorithm': algorithm, 'key_id': key_id, 'ts_added_ms': time_now, 'key_json': json_bytes} for (algorithm, key_id, json_bytes) in new_keys])
        self._invalidate_cache_and_stream(txn, self.count_e2e_one_time_keys, (user_id, device_id))
    (yield self.runInteraction('add_e2e_one_time_keys_insert', _add_e2e_one_time_keys))
