code: def write_multitag_json(output_filename, dataset):
      json_dataset = []
      for sentence in dataset:
          json_sentence = []
          for word in sentence:
              word = {
                  "text": word[0],
                  "ner": word[1],
                  "multi_ner": word[2],
              }
              json_sentence.append(word)
          json_dataset.append(json_sentence)
      with open(output_filename, "w", encoding="utf-8") as fout:
          json.dump(json_dataset, fout, indent=2)
  
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 5 for calling a global function with example usage: write_multitag_json(output_filename, dataset) without return types