code: def write_sentences(output_filename, dataset):
      """
      Write exactly one output file worth of dataset
      """
      os.makedirs(os.path.split(output_filename)[0], exist_ok=True)
      with open(output_filename, "w", encoding="utf-8") as fout:
          for sent_idx, sentence in enumerate(dataset):
              for word_idx, word in enumerate(sentence):
                  if len(word) > 2:
                      word = word[:2]
                  try:
                      fout.write("%s\t%s\n" % word)
                  except TypeError:
                      raise TypeError(
                          "Unable to process sentence %d word %d of file %s"
                          % (sent_idx, word_idx, output_filename)
                      )
              fout.write("\n")
  
imports: from collections import defaultdict
  import json
  import os
  import random
  from stanza.models.common.doc import Document
  import stanza.utils.datasets.ner.prepare_ner_file
label_desc: Use image node_id 3 for calling a global function with example usage: write_sentences(output_filename, dataset) without return types