code: def _parse_path(
      event: metadata_store_pb2.Event,
  ) -> List[Tuple[str, int]]:
      """Parses event.path to the list of (key, index)."""
      if len(event.path.steps) % 2 != 0:
          raise ValueError(
              "len(event.path.steps) should be even number but got: "
              f"{event.path.steps}."
          )
      result = []
      steps = list(event.path.steps)
      i = 0
      while steps:
          s0, s1, *steps = steps
          if s0.WhichOneof("value") != "key":
              raise ValueError(
                  f'steps[{i}] should have "key" but got {event.path.steps}.'
              )
          if s1.WhichOneof("value") != "index":
              raise ValueError(
                  f'steps[{i+1}] should have "index" but got {event.path.steps}.'
              )
          i += 2
          result.append((s0.key, s1.index))
      return result
  
file_path: tfx/tfx/orchestration/portable/mlmd/event_lib.py
imports: import collections
  import contextlib
  from typing import Dict, List, Optional, Sequence, Tuple, TypeVar
  from tfx import types
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: _parse_path(event) and returns: result