<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _parse_wikiheadlines(path):
 """Generates examples from Wikiheadlines dataset file."""

  lang_match = re.match(r".*\.([a-z][a-z])-([a-z][a-z])$", path)
  assert lang_match is not None, "Invalid Wikiheadlines filename: %s" % path
  l1, l2 = lang_match.groups()
  with tf.io.gfile.GFile(path) as f:
    for line in f:
      s1, s2 = line.split("|||")
      yield {
          l1: s1.strip(),
          l2: s2.strip()
      }