<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def init_from_dataset_and_submissions_write_to_datastore( self, dataset_batches, attack_submission_ids):
 """Init list of adversarial batches from dataset batches and submissions. Args: dataset_batches: instances of DatasetBatches attack_submission_ids: iterable with IDs of all (targeted and nontargeted) attack submissions, could be obtains as CompetitionSubmissions.get_all_attack_ids() """

    batches_x_attacks = itertools.product(dataset_batches.data.keys(),
                                          attack_submission_ids)
    for idx, (dataset_batch_id, attack_id) in enumerate(batches_x_attacks):
      adv_batch_id = ADVERSARIAL_BATCH_ID_PATTERN.format(idx)
      self.add_batch(adv_batch_id,
                     {'dataset_batch_id': dataset_batch_id,
                      'submission_id': attack_id})
    self.write_to_datastore()