code: def _ArtifactType(  # pylint: disable=invalid-name
      name: Optional[str] = None,
      annotation: Optional[Type[SystemArtifact]] = None,
      properties: Optional[Dict[str, Property]] = None,
      mlmd_artifact_type: Optional[
          metadata_store_pb2.ArtifactType
      ] = None,
  ) -> Type[Artifact]:
      """Experimental interface: internal use only.
  
      Construct an artifact type.
  
      Equivalent to subclassing Artifact and providing relevant properties. The user
      must either provide (1) a type "name" and "properties" or (2) a MLMD
      metadata_store_pb2.ArtifactType protobuf message as the "mlmd_artifact_type"
      parameter.
  
      Args:
        name: Name of the artifact type in MLMD. Must be provided unless a protobuf
          message is provided in the "mlmd_artifact_type" parameter.
        annotation: Annotation of the artifact type. It can be any of the system
          artifact classes from third_party/py/tfx/types/system_artifacts.py.
        properties: Dictionary of properties mapping property name keys to
          `Parameter` object instances. Must be provided unless a protobuf message
          is provided in the "mlmd_artifact_type" parameter.
        mlmd_artifact_type: A ML Metadata metadata_store_pb2.ArtifactType protobuf
          message corresponding to the type being created.
  
      Returns:
        An Artifact class corresponding to the specified type.
      """
      if mlmd_artifact_type:
          if name or annotation or properties:
              raise ValueError(
                  'The "name", "annotation" and "properties" fields should not be '
                  'passed when the "mlmd_artifact_type" parameter is set, in '
                  "_ArtifactType call."
              )
          if not mlmd_artifact_type.name:
              raise ValueError(
                  'Artifact type proto must have "name" field set.'
              )
          properties = {}
          for (
              name,
              property_type,
          ) in mlmd_artifact_type.properties.items():
              if property_type == metadata_store_pb2.PropertyType.INT:
                  properties[name] = Property(PropertyType.INT)
              elif (
                  property_type
                  == metadata_store_pb2.PropertyType.DOUBLE
              ):
                  properties[name] = Property(PropertyType.FLOAT)
              elif (
                  property_type == metadata_store_pb2.PropertyType.PROTO
              ):
                  properties[name] = Property(PropertyType.PROTO)
              elif (
                  property_type
                  == metadata_store_pb2.PropertyType.STRUCT
              ):
                  properties[name] = Property(PropertyType.JSON_VALUE)
              elif (
                  property_type
                  == metadata_store_pb2.PropertyType.STRING
              ):
                  properties[name] = Property(PropertyType.STRING)
              elif (
                  property_type
                  == metadata_store_pb2.PropertyType.BOOLEAN
              ):
                  properties[name] = Property(PropertyType.BOOLEAN)
              else:
                  raise ValueError(
                      "Unsupported MLMD property type: %s."
                      % property_type
                  )
          annotation = None
          if (
              mlmd_artifact_type.base_type
              != metadata_store_pb2.ArtifactType.UNSET
          ):
              extensions = (
                  metadata_store_pb2.ArtifactType.SystemDefinedBaseType.DESCRIPTOR.values_by_number[
                      mlmd_artifact_type.base_type
                  ]
                  .GetOptions()
                  .Extensions
              )
              mlmd_base_type_name = extensions[
                  metadata_store_pb2.system_type_extension
              ].type_name
              annotation = type(
                  mlmd_base_type_name,
                  (SystemArtifact,),
                  {
                      "MLMD_SYSTEM_BASE_TYPE": mlmd_artifact_type.base_type,
                  },
              )
  
          return type(
              str(mlmd_artifact_type.name),
              (Artifact,),
              {
                  "TYPE_NAME": mlmd_artifact_type.name,
                  "TYPE_ANNOTATION": annotation,
                  "PROPERTIES": properties,
              },
          )
      else:
          if not name:
              raise ValueError(
                  '"name" parameter must be passed to _ArtifactType when a '
                  "metadata_store_pb2.ArtifactType object is not passed for the "
                  '"mlmd_artifact_type" parameter.'
              )
          return type(
              name,
              (Artifact,),
              {
                  "TYPE_NAME": name,
                  "TYPE_ANNOTATION": annotation,
                  "PROPERTIES": properties,
              },
          )
  
imports: import builtins
  import copy
  import importlib
  import json
  from typing import Any, Dict, List, Optional, Type, Union
  from absl import logging
  from tfx.types import artifact_property
  from tfx.types.system_artifacts import SystemArtifact
  from tfx.utils import doc_controls
  from tfx.utils import json_utils
  from tfx.utils import proto_utils
  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: _ArtifactType(name, annotation, properties, mlmd_artifact_type) and returns: type, type