docstr: Create a mapping from intent to messages.
  
  This allows a faster intent lookup.
docstr_tok: ["Create","a","mapping","from","intent","to","messages",".","This","allows","a","faster","intent","lookup","."]
code: def _create_reverse_mapping(
      data: "TrainingData",
  ) -> Dict[Dict[Text, Any], List["Message"]]:
      """Create a mapping from intent to messages.
  
      This allows a faster intent lookup.
      """
      d = defaultdict(list)
      for example in data.training_examples:
          if example.get(INTENT, {}) is not None:
              d[example.get(INTENT, {})].append(example)
      return d
  
imports: from collections import defaultdict, deque
  import random
  from typing import Any, Text, List, Deque, Dict, Optional, Set, TYPE_CHECKING, Union, cast
  import rasa.shared.utils.io
  from rasa.shared.constants import INTENT_MESSAGE_PREFIX
  from rasa.shared.core.constants import ACTION_LISTEN_NAME
  from rasa.shared.core.domain import Domain
  from rasa.shared.core.events import UserUttered, ActionExecuted, Event
  from rasa.shared.core.generator import TrainingDataGenerator
  from rasa.shared.core.training_data.structures import StoryGraph, StoryStep
  from rasa.shared.nlu.constants import ENTITY_ATTRIBUTE_VALUE, INTENT, TEXT, ENTITY_ATTRIBUTE_TYPE, INTENT_NAME_KEY
label_desc: Use image node_id 2 for calling the UserMessageGenerator obj's underlying member method code with example usage: obj._create_reverse_mapping(data) and returns: d