code: def build(opt):
      dpath = os.path.join(opt["datapath"], "MovieDialog")
      # 2019-12-11 bump version with changed url
      version = "3.01"
  
      if not build_data.built(dpath, version_string=version):
          print("[building data: " + dpath + "]")
          if build_data.built(dpath):
              # An older version exists, so remove these outdated files.
              build_data.remove_dir(dpath)
          build_data.make_dir(dpath)
  
          # Download the data.
          RESOURCES[0].download_file(dpath)
  
          dpath2 = os.path.join(
              dpath, "movie_dialog_dataset", "task4_reddit"
          )
          build_data.make_dir(dpath2)
  
          RESOURCES[1].download_file(dpath2)
  
          # remove pipes from task 4 labels, only one label per example
          for root, _subfolder, files in os.walk(
              os.path.join(dpath2, "task4_reddit")
          ):
              for f in files:
                  if f.endswith("txt"):
                      read_fn = os.path.join(root, f)
                      head = "task4_reddit_"
                      tail = f[len(head) :]
                      write_fn = os.path.join(
                          root, head + "pipeless_" + tail
                      )
                      with PathManager.open(
                          read_fn
                      ) as read, PathManager.open(
                          write_fn, "w"
                      ) as write:
                          for line in read:
                              write.write(
                                  line.replace("|", " __PIPE__ ") + "\n"
                              )
  
          # Mark the data as built.
          build_data.mark_done(dpath, version_string=version)
  
imports: import parlai.core.build_data
  import os
  from parlai.utils.io import PathManager
  from parlai.core.build_data import DownloadableFile
label_desc: Use image node_id 1 for calling a global function with example usage: build(opt) without return types