code: def iob2(tags: List[str]) -> List[str]:
      r"""
      检查数据是否是合法的 ``IOB`` 数据，如果是 ``IOB1`` 会被自动转换为 ``IOB2`` 。两种格式的区别见
      https://datascience.stackexchange.com/questions/37824/difference-between-iob-and-iob2-format
  
      :param tags: 需要转换的 tags
      """
      for i, tag in enumerate(tags):
          if tag == "O":
              continue
          split = tag.split("-")
          if len(split) != 2 or split[0] not in ["I", "B"]:
              raise TypeError(
                  "The encoding schema is not a valid IOB type."
              )
          if split[0] == "B":
              continue
          elif i == 0 or tags[i - 1] == "O":  # conversion IOB1 to IOB2
              tags[i] = "B" + tag[1:]
          elif tags[i - 1][1:] == tag[1:]:
              continue
          else:  # conversion IOB1 to IOB2
              tags[i] = "B" + tag[1:]
      return tags
  
file_path: fastNLP/fastNLP/io/pipe/utils.py
imports: from typing import List
  from ...core.vocabulary import Vocabulary
  from fastNLP.core.log import logger
  from pkg_resources import parse_version
label_desc: Use image node_id 1 for calling a global function with example usage: iob2(tags) and returns: tags