code: def make_parlai_format(data: list, dpath: str):
      train_p = 0.6
      valid_p = 0.2
      test_p = 1 - (train_p + valid_p)
  
      assert train_p > 0
      assert valid_p > 0
      assert test_p > 0
  
      data_len = len(data)
  
      first_valid = int(data_len * train_p)
      first_test = int(data_len * (train_p + valid_p))
  
      data_train = data[:first_valid]
      data_valid = data[first_valid:first_test]
      data_test = data[first_test:]
  
      data_train_txt = "\n".join(data_train)
      data_valid_txt = "\n".join(data_valid)
      data_test_txt = "\n".join(data_test)
  
      path_train = os.path.join(dpath, "train.txt")
      path_valid = os.path.join(dpath, "valid.txt")
      path_test = os.path.join(dpath, "test.txt")
  
      with PathManager.open(path_train, "w") as f_train:
          f_train.write(data_train_txt)
  
      with PathManager.open(path_valid, "w") as f_valid:
          f_valid.write(data_valid_txt)
  
      with PathManager.open(path_test, "w") as f_test:
          f_test.write(data_test_txt)
  
imports: import os
  import json
  from parlai.core.build_data import DownloadableFile
  from parlai.utils.io import PathManager
  import parlai.core.build_data
label_desc: Use image node_id 1 for calling a global function with example usage: make_parlai_format(data, dpath) without return types