code: def convert_iob_to_simple_tags(preds, spans, probs):
      contains_named_entity = len([x for x in preds if "B-" in x]) != 0
      simple_tags = []
      merged_spans = []
      tag_probs = []
      open_tag = False
      for pred, span, prob in zip(preds, spans, probs):
          # no entity
          if not ("B-" in pred or "I-" in pred):
              if open_tag:
                  # end of one tag
                  merged_spans.append(cur_span)
                  simple_tags.append(cur_tag)
                  tag_probs.append(prob)
                  open_tag = False
              continue
  
          # new span starting
          elif "B-" in pred:
              if open_tag:
                  # end of one tag
                  merged_spans.append(cur_span)
                  simple_tags.append(cur_tag)
                  tag_probs.append(prob)
              cur_tag = pred.replace("B-", "")
              cur_span = span
              open_tag = True
  
          elif "I-" in pred:
              this_tag = pred.replace("I-", "")
              if open_tag and this_tag == cur_tag:
                  cur_span = (cur_span[0], span[1])
              elif open_tag:
                  # end of one tag
                  merged_spans.append(cur_span)
                  simple_tags.append(cur_tag)
                  tag_probs.append(prob)
                  open_tag = False
      if open_tag:
          merged_spans.append(cur_span)
          simple_tags.append(cur_tag)
          tag_probs.append(prob)
          open_tag = False
      if contains_named_entity and len(simple_tags) == 0:
          raise Exception(
              "Predicted Named Entities lost when converting from IOB to simple tags. Please check the format"
              "of the training data adheres to either adheres to IOB2 format or is converted when "
              "read_ner_file() is called."
          )
      return simple_tags, merged_spans, tag_probs
  
imports: import hashlib
  import json
  import logging
  import random
  import os
  import signal
  import numpy
  import torch
  import torch.distributed
  from requests.exceptions import ConnectionError
  from torch import multiprocessing
  import mlflow
  from copy import deepcopy
  import pandas
  from tqdm import tqdm
  import time
  import pickle
  from farm.visual.ascii.images import WELCOME_BARN, WORKER_M, WORKER_F, WORKER_X
label_desc: Use image node_id 5 for calling a global function with example usage: convert_iob_to_simple_tags(preds, spans, probs) and returns: simple_tags,  merged_spans,  tag_probs