code: def save_dataset_for_two_class(
      dataset, troll_type, output_data_path, generation_fold
  ):
      # split dataset into postive and negative for balanced training
      output_file_name = os.path.join(
          output_data_path,
          troll_type + FILE_TYPE_EXTENSIONS[generation_fold],
      )
      with open(output_file_name, "w") as outfile:
          for json_blob in dataset:
              outfile.write(json.dumps(json_blob))
              outfile.write("\n")
  
      dataset_pos = []
      dataset_neg = []
      for each_sample in dataset:
          if each_sample["labels"][0] == "__ok__":
              dataset_pos.append(each_sample)
          else:
              dataset_neg.append(each_sample)
      output_file_name = os.path.join(
          output_data_path,
          "pos_" + troll_type + FILE_TYPE_EXTENSIONS[generation_fold],
      )
      with open(output_file_name, "w") as outfile:
          for json_blob in dataset_pos:
              outfile.write(json.dumps(json_blob))
              outfile.write("\n")
      output_file_name = os.path.join(
          output_data_path,
          "neg_" + troll_type + FILE_TYPE_EXTENSIONS[generation_fold],
      )
      with open(output_file_name, "w") as outfile:
          for json_blob in dataset_neg:
              outfile.write(json.dumps(json_blob))
              outfile.write("\n")
  
file_path: ParlAI/parlai/tasks/safety_mix/build.py
imports: import copy
  import hashlib
  import json
  import os
  import random
  import numpy
  import parlai.core.build_data
  import parlai.utils.logging
  from parlai.core.build_data import DownloadableFile
label_desc: Use image node_id 9 for calling a global function with example usage: save_dataset_for_two_class(dataset, troll_type, output_data_path, generation_fold) without return types