class_docstr: Helper class to handle metadata I/O.
  
  Not thread-safe without external synchronisation.
docstr: Commits a single event to the repository.
docstr_tok: ["Commits","a","single","event","to","the","repository","."]
code: def _prepare_event(
      self,
      event_type: metadata_store_pb2.Event.Type,
      execution_id: Optional[int] = None,
      artifact_id: Optional[int] = None,
      key: Optional[str] = None,
      index: Optional[int] = None,
  ) -> metadata_store_pb2.Event:
      """Commits a single event to the repository."""
      event = metadata_store_pb2.Event()
      event.type = event_type
      if execution_id:
          event.execution_id = execution_id
      if artifact_id:
          event.artifact_id = artifact_id
      if key is not None:
          step = event.path.steps.add()
          step.key = key
      if index is not None:
          step = event.path.steps.add()
          step.index = index
      return event
  
imports: import collections
  import copy
  import hashlib
  import itertools
  import os
  import random
  import time
  import types
  from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
  import absl
  from tfx.dsl.io import fileio
  from tfx.orchestration import data_types
  from tfx.orchestration.portable.mlmd import event_lib
  from tfx.types import artifact
  from tfx.types import artifact_utils
  import ml_metadata
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 14 for calling the Metadata obj's underlying member method code with example usage: obj._prepare_event(event_type, execution_id, artifact_id, key, index) and returns: event