code: def process_imdb(infold, outfold, uncased, modes=["train", "test"]):
      if not os.path.exists(infold):
          link = "https://ai.stanford.edu/~amaas/data/sentiment/"
          raise ValueError(
              f"Data not found at {infold}. "
              f"Please download IMDB reviews dataset from {link} and "
              f"extract it into the folder specified by source_data_dir argument."
          )
  
      logging.info(f"Processing IMDB dataset and store at {outfold}")
      os.makedirs(outfold, exist_ok=True)
  
      outfiles = {}
      for mode in modes:
          outfiles[mode] = open(
              os.path.join(outfold, mode + ".tsv"), "w"
          )
          for sent in ["neg", "pos"]:
              if sent == "neg":
                  label = 0
              else:
                  label = 1
              files = glob.glob(f"{infold}/{mode}/{sent}/*.txt")
              for file in files:
                  with open(file, "r") as f:
                      review = f.read().strip()
                  if uncased:
                      review = review.lower()
                  review = review.replace("<br />", "")
                  outfiles[mode].write(f"{review}\t{label}\n")
  
      for mode in modes:
          outfiles[mode].close()
  
      class_labels_file = open(
          os.path.join(outfold, "label_ids.tsv"), "w"
      )
      class_labels_file.write("negative\npositive\n")
      class_labels_file.close()
  
file_path: NeMo/examples/nlp/text_classification/data/import_datasets.py
imports: import argparse
  import csv
  import glob
  import os
  from os.path import exists
  import tqdm
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: process_imdb(infold, outfold, uncased, modes) without return types