code: def write_new_file(save_dir, input_path, old_file, simplify):
      starts_b = False
      with open(input_path, "r+", encoding="utf-8") as iob:
          new_filename = (
              (os.path.splitext(old_file)[0] + ".4class.tsv")
              if simplify
              else old_file
          )
          with open(
              os.path.join(save_dir, new_filename),
              "w",
              encoding="utf-8",
          ) as fout:
              for i, line in enumerate(iob):
                  if (
                      i == 0 or i == 1
                  ):  # skip over the URL and subsequent space line.
                      continue
                  line = line.strip()
                  if not line:
                      fout.write("\n")
                      continue
                  label = line.split("\t")
                  if simplify:
                      try:
                          edited = process_label(
                              label, is_start=starts_b
                          )  # processed label line labels
                      except ValueError as e:
                          raise ValueError(
                              "Error in %s at line %d" % (input_path, i)
                          ) from e
                      assert edited
                      starts_b = edited[-1]
                      fout.write("\t".join(edited[:-1]))
                      fout.write("\n")
                  else:
                      fout.write("%s\t%s\n" % (label[0], label[1]))
  
file_path: stanza/stanza/utils/datasets/ner/simplify_en_worldwide.py
imports: import argparse
  import os
  import tempfile
  import stanza
  from stanza.utils.default_paths import get_default_paths
  from stanza.utils.datasets.ner.utils import read_tsv
  from stanza.utils.get_tqdm import get_tqdm
label_desc: Use image node_id 3 for calling a global function with example usage: write_new_file(save_dir, input_path, old_file, simplify) without return types