code: def verify_artifacts(
      artifacts: Union[
          Dict[str, List[Artifact]], List[Artifact], Artifact
      ]
  ) -> None:
      """Check that all artifacts have uri and exist at that uri.
  
      Args:
          artifacts: artifacts dict (key -> types.Artifact), single artifact list,
            or artifact instance.
  
      Raises:
        TypeError: if the input is an invalid type.
        RuntimeError: if artifact is not valid.
      """
      if isinstance(artifacts, Artifact):
          artifact_list = [artifacts]
      elif isinstance(artifacts, list):
          artifact_list = artifacts
      elif isinstance(artifacts, dict):
          artifact_list = list(itertools.chain(*artifacts.values()))
      else:
          raise TypeError
  
      for artifact_instance in artifact_list:
          if not artifact_instance.uri:
              raise RuntimeError(
                  f"Artifact {artifact_instance} does not have uri"
              )
          if not fileio.exists(artifact_instance.uri):
              raise RuntimeError(
                  f"Artifact uri {artifact_instance.uri} is missing"
              )
  
file_path: tfx/tfx/types/artifact_utils.py
imports: import itertools
  import json
  import os
  from typing import Dict, List, Optional, Type, Union
  from absl import logging
  from tfx.dsl.io import fileio
  from tfx.types import artifact
  from tfx.types import standard_artifact_utils
  from tfx.types import value_artifact
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 10 for calling a global function with example usage: verify_artifacts(artifacts) without return types