code: def validate_input_dict(
      input_dict: typing_utils.ArtifactMultiMap,
      valid_keys: Set[str],
      requires_all: bool = False,
  ):
      """Checks that the input_dict is properly formatted."""
      if requires_all and set(input_dict.keys()) != valid_keys:
          raise exceptions.InvalidArgument(
              f"input_dict must have all keys in {valid_keys}, but only had "
              f"{input_dict.keys()}"
          )
  
      for key in input_dict.keys():
          if key not in valid_keys:
              raise exceptions.InvalidArgument(
                  "input_dict can only have keys {valid_keys}, but contained"
                  f" key {key}."
              )
  
          for artifact in input_dict[key]:
              if artifact.TYPE_NAME != ARTIFACT_TYPE_NAME_BY_KEY[key]:
                  raise exceptions.InvalidArgument(
                      f'Artifacts of input_dict["{key}"] are expected to have artifacts'
                      f" with TYPE_NAME {ARTIFACT_TYPE_NAME_BY_KEY[key]}, but"
                      f' artifact {artifact} in input_dict["{key}"] had TYPE_NAME'
                      f" {artifact.TYPE_NAME}."
                  )
  
file_path: tfx/tfx/dsl/input_resolution/ops/ops_utils.py
imports: from typing import Dict, List, Optional, Sequence, Set
  from tfx import types
  from tfx.orchestration.portable.input_resolution import exceptions
  from tfx.orchestration.portable.mlmd import filter_query_builder
  from tfx.utils import typing_utils
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 3 for calling a global function with example usage: validate_input_dict(input_dict, valid_keys, requires_all) without return types