code: def create_fb_format(data, dpath):
      fw1 = open(os.path.join(dpath, "train.txt"), "w")
      fw2 = open(os.path.join(dpath, "valid.txt"), "w")
      fw3 = open(os.path.join(dpath, "test.txt"), "w")
      for i in range(0, len(data) - 1, 2):
          fout = fw1
          if (i % 500) == 0:
              fout = fw2
          elif (i % 500) == 2:
              fout = fw3
          use = True
          x = data[i].rstrip(" ").lstrip(" ").replace("\t", " ")
          y = data[i + 1].rstrip(" ").lstrip(" ").replace("\t", " ")
          x = x.replace("|", " __PIPE__ ")
          y = y.replace("|", " __PIPE__ ")
          x = "".join(list(map(replace_emoji, x)))
          y = "".join(list(map(replace_emoji, y)))
          x = split_punctuation(unidecode.unidecode(x))
          y = split_punctuation(unidecode.unidecode(y))
          x = " ".join(x.split())
          y = " ".join(y.split())
  
          if len(x) < 1 or len(y) < 1:
              use = False
          if use:
              s = "text:" + x + "\tlabels:" + y + "\tepisode_done:True"
              fout.write("{} \n".format(s))
      fw1.close()
      fw2.close()
      fw3.close()
  
file_path: ParlAI/parlai/tasks/twitter/build.py
imports: import io
  import gzip
  import parlai.core.build_data
  import os
  from parlai.core.build_data import DownloadableFile
  from parlai.utils.io import PathManager
label_desc: Use image node_id 3 for calling a global function with example usage: create_fb_format(data, dpath) without return types