code: def parse_xml_string(xml_str: str) -> List[Pair]:
      """Process ASSIN2 xml files content.
  
      Modified from https://github.com/erickrf/assin.
  
      Args:
        xml_str: string with XML contents
  
      Returns:
        list of Pair objects
      """
      pairs = []
      root = ET.fromstring(xml_str)
  
      for xml_pair in root.iter("pair"):
          # Get fields.
          text = get_element_text(xml_pair, "t")
          hypothesis = get_element_text(xml_pair, "h")
  
          attribs = dict(xml_pair.items())
          id_ = int(attribs["id"])
          entailment = attribs["entailment"]
          similarity = float(attribs["similarity"])
  
          # Assert valid fields.
          if entailment not in _VALID_ENTAILMENT:
              raise ValueError(
                  f"Entailment should be in {_VALID_ENTAILMENT}, got {entailment}."
              )
          pairs.append(
              Pair(
                  text=text,
                  hypothesis=hypothesis,
                  id=id_,
                  entailment=entailment,
                  similarity=similarity,
              )
          )
      return pairs
  
imports: import dataclasses
  from typing import List, Optional
  from xml.etree import cElementTree
label_desc: Use image node_id 2 for calling a global function with example usage: parse_xml_string(xml_str) and returns: pairs