code: def convert_to_bioes(sentences: list) -> list:
      """
      Returns a list of strings where each string represents a sentence in BIOES format
      """
      beios_sents = []
      for sentence in tqdm(sentences):
          sentence_toc = ""
          for ent in sentence:
              if ent["tag"] == "O":
                  sentence_toc += ent["tokens"][0] + "\tO" + "\n"
              else:
                  if len(ent["tokens"]) == 1:
                      sentence_toc += (
                          ent["tokens"][0] + "\tS-" + ent["tag"] + "\n"
                      )
                  else:
                      sentence_toc += (
                          ent["tokens"][0] + "\tB-" + ent["tag"] + "\n"
                      )
                      for token in ent["tokens"][1:-1]:
                          sentence_toc += (
                              token + "\tI-" + ent["tag"] + "\n"
                          )
                      sentence_toc += (
                          ent["tokens"][-1] + "\tE-" + ent["tag"] + "\n"
                      )
          beios_sents.append(sentence_toc)
      return beios_sents
  
file_path: stanza/stanza/utils/datasets/ner/convert_hy_armtdp.py
imports: import argparse
  import os
  import json
  import re
  import stanza
  import random
  from tqdm import tqdm
  from stanza import DownloadMethod, Pipeline
  import stanza.utils.default_paths
label_desc: Use image node_id 5 for calling a global function with example usage: convert_to_bioes(sentences) and returns: beios_sents