code: def to_bio2(tags):
      """
      Convert the original tag sequence to BIO2 format. If the input is already in BIO2 format,
      the original input is returned.
  
      Args:
          tags: a list of tags in either BIO or BIO2 format
  
      Returns:
          new_tags: a list of tags in BIO2 format
      """
      new_tags = []
      for i, tag in enumerate(tags):
          if tag in EMPTY_OR_O_TAG:
              new_tags.append(tag)
          elif tag[0] == "I":
              if (
                  i == 0
                  or tags[i - 1] == "O"
                  or tags[i - 1][1:] != tag[1:]
              ):
                  new_tags.append("B" + tag[1:])
              else:
                  new_tags.append(tag)
          else:
              new_tags.append(tag)
      return new_tags
  
file_path: stanza/stanza/models/ner/utils.py
imports: import logging
  from stanza.models.common.vocab import EMPTY
label_desc: Use image node_id 3 for calling a global function with example usage: to_bio2(tags) and returns: new_tags