code: def _parse_tmx(path):
      """Generates examples from TMX file."""
  
      def _get_tuv_lang(tuv):
          for k, v in tuv.items():
              if k.endswith("}lang"):
                  return v
          raise AssertionError(
              "Language not found in `tuv` attributes."
          )
  
      def _get_tuv_seg(tuv):
          segs = tuv.findall("seg")
          assert len(segs) == 1, "Invalid number of segments: %d" % len(
              segs
          )
          return segs[0].text
  
      with epath.Path(path).open("rb") as f:
          utf_f = codecs.getreader("utf-8")(f)
          for line_id, (_, elem) in enumerate(
              ElementTree.iterparse(utf_f)
          ):  # pytype: disable=wrong-arg-types
              if elem.tag == "tu":
                  yield line_id, {
                      _get_tuv_lang(tuv): _get_tuv_seg(tuv)
                      for tuv in elem.iterfind("tuv")
                  }
                  elem.clear()
  
imports: import codecs
  import functools
  import gzip
  import itertools
  import os
  import re
  from typing import List
  from xml.etree import ElementTree
  from absl import logging
  from etils import epath
  from tensorflow_datasets.core.utils import tree_utils
  import tensorflow_datasets.public_api
label_desc: Use image node_id 5 for calling a global function with example usage: _parse_tmx(path) and returns: segs, v