code: def parse_bsf(bsf_data: str) -> list:
      """
      Convert textual bsf representation to a list of named entities.
  
      :param bsf_data: data in the format 'T9	PERS 778 783    токен'
      :return: list of named tuples for each line of the data representing a single named entity token
      """
      if len(bsf_data.strip()) == 0:
          return []
  
      ln_ptrn = re.compile(
          r"(T\d+)\s(\w+)\s(\d+)\s(\d+)\s(.+?)(?=T\d+\s\w+\s\d+\s\d+|$)",
          flags=re.DOTALL,
      )
      result = []
      for m in ln_ptrn.finditer(bsf_data.strip()):
          bsf = BsfInfo(
              m.group(1),
              m.group(2),
              int(m.group(3)),
              int(m.group(4)),
              m.group(5).strip(),
          )
          result.append(bsf)
      return result
  
file_path: stanza/stanza/utils/datasets/ner/convert_bsf_to_beios.py
imports: import argparse
  import logging
  import os
  import glob
  from collections import namedtuple
  import re
  from typing import Tuple
  from tqdm import tqdm
  from random import choices, shuffle
label_desc: Use image node_id 4 for calling a global function with example usage: parse_bsf(bsf_data) and returns: result, list