code: def _validate_properties_schema(
      instance_schema: str,
      properties: Optional[Mapping[str, artifact.PropertyType]] = None,
  ):
      """Validates the declared property types are consistent with the schema.
  
      Args:
        instance_schema: YAML string of the artifact property schema.
        properties: The actual property schema of an Artifact Python class.
  
      Raises:
        KeyError: When actual property have additional properties than what's
          specified in the YAML schema.
        TypeError: When the same property is declared with different types in YAML
          schema and the Artifact Python class.
      """
      schema = yaml.safe_load(instance_schema).get("properties", {})
      properties = properties or {}
  
      for k, v in properties.items():
          if k not in schema:
              raise KeyError(
                  "Actual property: {} not expected in artifact type schema:"
                  " {}".format(k, schema)
              )
          # It's okay that we only validate the constant_value case, since
          # RuntimeParameter's ptype should be validated during component
          # instantiation.
          # We only validate primitive-typed property for now because other types can
          # have nested schema in the YAML spec as well.
          # pytype: disable=attribute-error  # use-enum-overlay
          if (
              schema[k]["type"] == _YAML_INT_TYPE
              and v.type != artifact.PropertyType.INT
              or schema[k]["type"] == _YAML_STRING_TYPE
              and v.type != artifact.PropertyType.STRING
              or schema[k]["type"] == _YAML_DOUBLE_TYPE
              and v.type != artifact.PropertyType.FLOAT
          ):
              raise TypeError(
                  f"Property type mismatched at {k} for schema: {schema}. "
                  f'Expected {schema[k]["type"]} but got {v.type}'
              )
  
imports: import itertools
  import json
  import os
  import re
  from typing import Any, Dict, List, Mapping, Optional, Type, Union
  from kfp.pipeline_spec import pipeline_spec_pb2
  from tfx import types
  from tfx.dsl.io import fileio
  from tfx.orchestration import data_types
  from tfx.orchestration.kubeflow.v2 import parameter_utils
  from tfx.proto.orchestration import placeholder_pb2
  from tfx.types import artifact
  from tfx.types import channel
  from tfx.types import standard_artifacts
  from tfx.types.experimental import simple_artifacts
  from tfx.utils import json_utils
  from tfx.utils import name_utils
  import yaml
  from google.protobuf import struct_pb2
  from google.protobuf import json_format
  from google.protobuf import message
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 3 for calling a global function with example usage: _validate_properties_schema(instance_schema, properties) without return types