code: def get_element_text(xml_pair: ET.Element, tag: str) -> Optional[str]:
      """Returns the text associated with a given tag."""
      element = xml_pair.find(tag)
      assert element is not None, f'The tag "{tag}" was not found.'
      return element.text
  
imports: import dataclasses
  from typing import List, Optional
  from xml.etree import cElementTree
label_desc: Use image node_id 1 for calling a global function with example usage: get_element_text(xml_pair, tag) and returns: element