code: def _create_anomalies_alerts(
      anomalies: anomalies_pb2.Anomalies,
      split_pair: str,
  ) -> list[component_generated_alert_pb2.ComponentGeneratedAlertInfo]:
      """Creates an alert for each anomaly in the anomalies artifact."""
      result = []
      # Information about dataset-level anomalies, such as "High num examples in
      # current dataset versus the previous span."
      if anomalies.HasField("dataset_anomaly_info"):
          result.extend(
              _generate_alerts_info_proto(
                  anomalies.dataset_anomaly_info, split_pair
              )
          )
      # Information about feature-level anomalies, such as "High Linfty distance
      # between current and previous."
      for _, info in anomalies.anomaly_info.items():
          result.extend(_generate_alerts_info_proto(info, split_pair))
      return result
  
imports: import os
  from typing import Any, Dict
  from absl import logging
  import tensorflow_data_validation
  from tensorflow_data_validation.utils import path
  from tensorflow_data_validation.utils import schema_util
  from tfx import types
  from tfx.components.statistics_gen import stats_artifact_utils
  from tfx.dsl.components.base import base_executor
  from tfx.orchestration.experimental.core import component_generated_alert_pb2
  from tfx.orchestration.experimental.core import constants
  from tfx.proto import distribution_validator_pb2
  from tfx.proto.orchestration import execution_result_pb2
  from tfx.types import artifact_utils
  from tfx.types import standard_component_specs
  from tfx.utils import json_utils
  from tfx.utils import monitoring_utils
  from tfx.utils import writer_utils
  from google.protobuf import any_pb2
  from tensorflow_metadata.proto.v0 import anomalies_pb2
  from tensorflow_metadata.proto.v0 import schema_pb2
  from tensorflow_metadata.proto.v0 import statistics_pb2
label_desc: Use image node_id 5 for calling a global function with example usage: _create_anomalies_alerts(anomalies, split_pair) and returns: result