code: def generate_model_card_for_model(
      store: mlmd.MetadataStore,
      model_id: int,
      pipeline_types: Optional[PipelineTypes] = None,
  ) -> model_card_module.ModelCard:
      """Populates model card properties for a model artifact.
  
      It traverse the parents and children of the model artifact, and maps related
      artifact properties and lineage information to model card property. The
      graphics derived from the artifact payload are handled separately.
  
      Args:
        store: A ml-metadata MetadataStore instance.
        model_id: The id for the model artifact in the `store`.
        pipeline_types: An optional set of types if the `store` uses custom types.
  
      Returns:
        A ModelCard data object with the properties.
  
      Raises:
        ValueError: If the `model_id` cannot be resolved as a model artifact in the
          given `store`.
      """
      if not pipeline_types:
          pipeline_types = _get_tfx_pipeline_types(store)
      _validate_model_id(store, pipeline_types.model_type, model_id)
      model_card = model_card_module.ModelCard()
      model_details = model_card.model_details
      trainers = _get_one_hop_executions(
          store,
          [model_id],
          _Direction.ANCESTOR,
          pipeline_types.trainer_type,
      )
      if trainers:
          model_details.name = _property_value(
              trainers[-1], "module_file"
          )
          model_details.version.name = _property_value(
              trainers[0], "checksum_md5"
          )
          model_details.references = [
              model_card_module.Reference(
                  reference=_property_value(
                      trainers[0], "pipeline_name"
                  )
              )
          ]
      return model_card
  
imports: import enum
  import os
  from typing import Any, Dict, Iterable, List, Optional, Sequence, Union
  import attr
  import ml_metadata
  import tensorflow
  import tensorflow_model_analysis
  from absl import logging
  from ml_metadata.proto import metadata_store_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
  from model_card_toolkit import model_card
label_desc: Use image node_id 8 for calling a global function with example usage: generate_model_card_for_model(store, model_id, pipeline_types) and returns: model_card