code: def get_artifact_schema(
      artifact_type: Type[artifact.Artifact],
  ) -> str:
      """Gets the YAML schema string associated with the artifact type.
  
      Args:
        artifact_type: the artifact type that the schema is generated for.
  
      Returns:
        the encoded yaml schema definition for the artifact.
  
      Raises:
        ValueError if custom artifact type name does not adhere to KFP schema title.
      """
      if artifact_type in _SUPPORTED_STANDARD_ARTIFACT_TYPES:
          # For supported first-party artifact types, get the built-in schema yaml per
          # its type name.
          schema_path = os.path.join(
              os.path.dirname(__file__),
              "artifact_types",
              "{}.yaml".format(artifact_type.TYPE_NAME),
          )
          return fileio.open(schema_path, "rb").read()
      else:
          # Otherwise, fall back to the generic `Artifact` type schema.
          # To recover the Python type object at runtime, the artifact TYPE_NAME will
          # be encoded as the schema title.
  
          # Read the generic artifact schema template.
          if not _SCHEMA_TITLE_RE.fullmatch(artifact_type.TYPE_NAME):
              raise ValueError(
                  f"Invalid custom artifact type name: {artifact_type.TYPE_NAME}"
              )
          schema_path = os.path.join(
              os.path.dirname(__file__),
              "artifact_types",
              "Artifact.yaml",
          )
          data = yaml.safe_load(fileio.open(schema_path, "rb").read())
          # Encode artifact TYPE_NAME.
          data["title"] = artifact_type.TYPE_NAME
          return yaml.dump(data, sort_keys=False)
  
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 11 for calling a global function with example usage: get_artifact_schema(artifact_type) and returns: fileio, yaml