code: def write_and_convert(tmp_path, raw_text):
      bio_file = tmp_path / "test.bio"
      with open(bio_file, "w", encoding="utf-8") as fout:
          fout.write(raw_text)
  
      json_file = tmp_path / "json.bio"
      process_dataset(bio_file, json_file)
  
      with open(json_file) as fin:
          doc = Document(json.load(fin))
  
      return doc
  
file_path: stanza/stanza/tests/datasets/ner/test_prepare_ner_file.py
imports: import pytest
  import json
  from stanza.models.common.doc import Document
  from stanza.utils.datasets.ner.prepare_ner_file import process_dataset
label_desc: Use image node_id 2 for calling a global function with example usage: write_and_convert(tmp_path, raw_text) and returns: doc