code: def parse_test_history(line: str) -> TestHistory | None:
      values = line.split("|")
      match_url = url_pattern.match(values[1].strip())
      if match_url:
          name = match_url.group(1)
          url = match_url.group(0)
          http_url = match_url.group(2)
          parsed_url = urlsplit(http_url)
          the_id = parsed_url[3].split("=")[1]
          comment = values[5] if len(values) >= 6 else ""
          try:
              states = parse_state_history(values[3])
          except Exception:
              states = []
          return TestHistory(
              test_id=the_id,
              name=name,
              states=states,
              url=url,
              comment=comment,
          )
      return None
  
imports: from __future__ import annotations
  import os
  import re
  import sys
  from datetime import datetime
  from pathlib import Path
  from typing import NamedTuple
  from urllib.parse import urlsplit
  import jinja2
  from bs4 import BeautifulSoup
  from github3 import login
  from jinja2 import StrictUndefined
  from tabulate import tabulate
label_desc: Use image node_id 3 for calling a global function with example usage: parse_test_history(line) and returns: None, TestHistory