code: def save_target_classes_for_batch(self,
                                      filename,
                                      image_batches,
                                      batch_id):
      
      images = image_batches.data[batch_id]['images']
      with open(filename, 'w') as f:
        for image_id, image_val in iteritems(images):
          target_class = self.get_target_class(image_val['dataset_image_id'])
          f.write('{0}.png,{1}\n'.format(image_id, target_class))
docs: Saves file with target class for given dataset batch.
  
      Args:
        filename: output filename
        image_batches: instance of ImageBatchesBase with dataset batches
        batch_id: dataset batch ID