code: def parse(fp, skiptypes=[]):
      root = None
      ne_prefix = ""
      ne_type = "O"
      name_prefix = ""
      name_type = "O"
  
      for event, elem in iterparse(fp, events=("start", "end")):
          if root is None:
              root = elem
  
          if event == "start":
              if elem.tag == "name":
                  _type = name_type_to_label(elem.attrib["type"])
                  if _type not in skiptypes and not (
                      _type == "ORG" and ne_type == "LOC"
                  ):
                      name_type = _type
                      name_prefix = "B-"
  
              elif elem.tag == "ne":
                  _type = ne_type_to_label(elem.attrib["type"])
                  if "/" in _type:
                      _type = ne_type_to_label(
                          _type[_type.index("/") + 1 :]
                      )
  
                  if _type not in skiptypes:
                      ne_type = _type
                      ne_prefix = "B-"
  
              elif elem.tag == "w":
                  if name_type == "PER" and elem.attrib["pos"] == "NN":
                      name_type = "O"
                      name_prefix = ""
  
          elif event == "end":
              if elem.tag == "sentence":
                  yield
  
              elif elem.tag == "name":
                  name_type = "O"
                  name_prefix = ""
  
              elif elem.tag == "ne":
                  ne_type = "O"
                  ne_prefix = ""
  
              elif elem.tag == "w":
                  if name_type != "O" and name_type != "OTH":
                      yield elem.text, name_prefix, name_type
                  elif ne_type != "O":
                      yield elem.text, ne_prefix, ne_type
                  else:
                      yield elem.text, "", "O"
  
                  if ne_type != "O":
                      ne_prefix = "I-"
  
                  if name_type != "O":
                      name_prefix = "I-"
  
          root.clear()
  
file_path: stanza/stanza/utils/datasets/ner/suc_to_iob.py
imports: from bz2 import BZ2File
  from xml.etree.ElementTree import iterparse
  import argparse
  from collections import Counter
  import sys
label_desc: Use image node_id 1 for calling a global function with example usage: parse(fp, skiptypes) without return types