code: def _probabilities_with_action_unlikely_intent_for(
      intent_names: List[Text],
      metadata_for_intent: Optional[Dict[Text, Dict[Text, Any]]] = None,
  ) -> Callable[
      [
          DefaultPolicyPredictionEnsemble,
          DialogueStateTracker,
          Domain,
          Any,
      ],
      PolicyPrediction,
  ]:
      _original = (
          DefaultPolicyPredictionEnsemble.combine_predictions_from_kwargs
      )
  
      def combine_predictions_from_kwargs(
          self,
          tracker: DialogueStateTracker,
          domain: Domain,
          **kwargs: Any,
      ) -> PolicyPrediction:
          latest_event = tracker.events[-1]
          if (
              isinstance(latest_event, UserUttered)
              and latest_event.parse_data["intent"]["name"]
              in intent_names
          ):
              intent_name = latest_event.parse_data["intent"]["name"]
              # Here we return `action_unlikely_intent` if the name of the
              # latest intent is present in `intent_names`. Accompanying
              # metadata is fetched from `metadata_for_intent` if it is present.
              # We need to do it because every time the tests are run,
              # training will result in different model weights which might
              # result in different predictions of `action_unlikely_intent`.
              # Because we're not testing `UnexpecTEDIntentPolicy`,
              # here we simply trigger it by
              # predicting `action_unlikely_intent` in a specified moment
              # to make the tests deterministic.
              return PolicyPrediction.for_action_name(
                  domain,
                  ACTION_UNLIKELY_INTENT_NAME,
                  action_metadata=metadata_for_intent.get(intent_name)
                  if metadata_for_intent
                  else None,
              )
  
          return _original(self, tracker, domain, **kwargs)
  
      return combine_predictions_from_kwargs
  
imports: import shutil
  import textwrap
  from pathlib import Path
  from typing import Text, Optional, Dict, Any, List, Callable, Coroutine
  import pytest
  import rasa.core.test
  import rasa.shared.utils.io
  from rasa.core.policies.ensemble import DefaultPolicyPredictionEnsemble
  from rasa.core.policies.policy import PolicyPrediction
  from rasa.shared.constants import LATEST_TRAINING_DATA_FORMAT_VERSION
  from rasa.shared.core.events import UserUttered
  from _pytest.monkeypatch import MonkeyPatch
  from _pytest.capture import CaptureFixture
  from rasa.core.agent import Agent, load_agent
  from rasa.utils.tensorflow.constants import QUERY_INTENT_KEY, NAME, THRESHOLD_KEY, SEVERITY_KEY, SCORE_KEY
  from rasa.core.constants import STORIES_WITH_WARNINGS_FILE
  from rasa.shared.core.constants import ACTION_UNLIKELY_INTENT_NAME
  from rasa.shared.core.trackers import DialogueStateTracker
  from rasa.shared.core.domain import Domain
  from rasa.core.policies.rule_policy import RulePolicy
  from rasa.shared.core.domain import State
  from rasa.core.policies.policy import SupportedData
  from rasa.shared.utils.io import read_file, read_yaml
label_desc: Use image node_id 1 for calling a global function with example usage: _probabilities_with_action_unlikely_intent_for(intent_names, metadata_for_intent) and returns: combine_predictions_from_kwargs, _original, PolicyPrediction