code: def trans_BIO_Dataset(config, examples: List[InputExample], mode):
      D = []
      for example in examples:
          span_infos = []
          sentence, label, d = (
              example.text_a.split(" "),
              example.label,
              [],
          )
          if len(sentence) > config.max_seq_len:
              continue
          assert len(sentence) == len(label)
          i = 0
          while i < len(sentence):
              flag = label[i]
              if flag[0] == "B":
                  start_index = i
                  i += 1
                  while i < len(sentence) and label[i][0] == "I":
                      i += 1
                  d.append([start_index, i, flag[2:]])
              elif flag[0] == "I":
                  start_index = i
                  i += 1
                  while i < len(sentence) and label[i][0] == "I":
                      i += 1
                  d.append([start_index, i, flag[2:]])
              else:
                  i += 1
          for s_e_flag in d:
              start_span, end_span, flag = (
                  s_e_flag[0],
                  s_e_flag[1],
                  s_e_flag[2],
              )
              span_infos.append(
                  {
                      "index": list(range(start_span, end_span)),
                      "type": flag,
                  }
              )
          D.append({"sentence": sentence, "ner": span_infos})
  
      config.logger.info(f"{mode} dataset example")
      for example in D[:2]:
          config.logger.info("\n{}".format(example))
      return D
  
imports: import json
  import torch
  from torch.utils.data import Dataset
  from torch.nn.utils.rnn import pad_sequence
  import numpy
  import prettytable
  from tqdm import tqdm
  from transformers import AutoTokenizer
  import os
  from deepke.name_entity_re.standard.tools import *
  import requests
  from typing import List
  from .utils import convert_index_to_text
label_desc: Use image node_id 4 for calling a global function with example usage: trans_BIO_Dataset(config, examples, mode) and returns: D