code: def _decode_test_result(
      data: dict[str, Any]
  ) -> TestResult | dict[str, Any]:
      if "__test_result__" in data:
          data.pop("__test_result__")
          if data["stats"] is not None:
              data["stats"] = TestStats(**data["stats"])
          if data["covered_lines"] is not None:
              data["covered_lines"] = [
                  tuple(loc) for loc in data["covered_lines"]
              ]
          return TestResult(**data)
      else:
          return data
  
imports: import dataclasses
  import json
  from typing import Any
  from .utils import StrJSON, TestName, FilterTuple, format_duration, normalize_test_name, print_warning
label_desc: Use image node_id 1 for calling a global function with example usage: _decode_test_result(data) and returns: TestResult, data