code: def _build_result_dictionary(
      result: typing_utils.ArtifactMultiDict,
      model_relations: ModelRelations,
      policy: int,
      artifact_type_by_name: Dict[str, metadata_store_pb2.ArtifactType],
  ):
      """Adds child artifacts to the result dictionary, based on the Policy."""
      if (
          policy == Policy.LATEST_EVALUATOR_BLESSED
          or policy == Policy.LATEST_BLESSED
      ):
          result[ops_utils.MODEL_BLESSSING_KEY] = [
              model_relations.latest_created(
                  artifact_type_by_name[
                      ops_utils.MODEL_BLESSING_TYPE_NAME
                  ]
              )
          ]
  
      # Intentionally use if instead of elif to handle LATEST_BLESSED Policy.
      if (
          policy == Policy.LATEST_INFRA_VALIDATOR_BLESSED
          or policy == Policy.LATEST_BLESSED
      ):
          result[ops_utils.MODEL_INFRA_BLESSING_KEY] = [
              model_relations.latest_created(
                  artifact_type_by_name[
                      ops_utils.MODEL_INFRA_BLESSSING_TYPE_NAME
                  ]
              )
          ]
  
      elif policy == Policy.LATEST_PUSHED:
          result[ops_utils.MODEL_PUSH_KEY] = [
              model_relations.latest_created(
                  artifact_type_by_name[ops_utils.MODEL_PUSH_TYPE_NAME]
              )
          ]
  
      return result
  
imports: import collections
  import enum
  from typing import Dict
  from tfx import types
  from tfx.dsl.input_resolution import resolver_op
  from tfx.dsl.input_resolution.ops import ops_utils
  from tfx.orchestration.portable.input_resolution import exceptions
  from tfx.orchestration.portable.mlmd import event_lib
  from tfx.orchestration.portable.mlmd import filter_query_builder
  from tfx.types import artifact_utils
  from tfx.utils import typing_utils
  from ml_metadata.proto import metadata_store_pb2
  from ml_metadata.tools.mlmd_resolver import metadata_resolver
label_desc: Use image node_id 4 for calling a global function with example usage: _build_result_dictionary(result, model_relations, policy, artifact_type_by_name) and returns: result