code: def _user_should_affirm(
      tracker: DialogueStateTracker, events_so_far: List[Event]
  ) -> bool:
      fallback_was_just_activated = any(
          isinstance(event, ActiveLoop) for event in events_so_far
      )
      if fallback_was_just_activated:
          return True
  
      return (
          _last_intent_name(tracker) == DEFAULT_NLU_FALLBACK_INTENT_NAME
      )
  
imports: import copy
  import time
  from typing import List, Text, Optional
  from rasa.core.actions import action
  from rasa.core.actions.loops import LoopAction
  from rasa.core.channels import OutputChannel
  from rasa.shared.core.domain import Domain
  from rasa.shared.core.events import Event, UserUtteranceReverted, ActionExecuted, UserUttered, ActiveLoop
  from rasa.core.nlg import NaturalLanguageGenerator
  from rasa.shared.core.trackers import DialogueStateTracker, EventVerbosity
  from rasa.shared.constants import DEFAULT_NLU_FALLBACK_INTENT_NAME
  from rasa.shared.core.constants import USER_INTENT_OUT_OF_SCOPE, ACTION_LISTEN_NAME, ACTION_DEFAULT_FALLBACK_NAME, ACTION_DEFAULT_ASK_AFFIRMATION_NAME, ACTION_DEFAULT_ASK_REPHRASE_NAME, ACTION_TWO_STAGE_FALLBACK_NAME
  from rasa.shared.nlu.constants import INTENT, PREDICTED_CONFIDENCE_KEY
  from rasa.utils.endpoints import EndpointConfig
label_desc: Use image node_id 4 for calling a global function with example usage: _user_should_affirm(tracker, events_so_far) and returns: unknown, True