code: def get_validated_dict(json_str: Text) -> Dict[Text, Text]:
      """Converts the provided `json_str` to a valid dict containing the entity
      attributes.
  
      Users can specify entity roles, synonyms, groups for an entity in a dict, e.g.
      [LA]{"entity": "city", "role": "to", "value": "Los Angeles"}.
  
      Args:
          json_str: The entity dict as string without "{}".
  
      Raises:
          SchemaValidationError if validation of parsed entity fails.
          InvalidEntityFormatException if provided entity is not valid json.
  
      Returns:
          Deserialized and validated `json_str`.
      """
      import json
      import rasa.shared.utils.validation as validation_utils
      import rasa.shared.nlu.training_data.schemas.data_schema as schema
  
      # add {} as they are not part of the regex
      try:
          data = json.loads(f"{{{json_str}}}")
      except JSONDecodeError as e:
          raise InvalidEntityFormatException.create_from(
              e,
              f"Incorrect training data format ('{{{json_str}}}'). "
              f"More info at {DOCS_URL_TRAINING_DATA_NLU}",
          ) from e
  
      validation_utils.validate_training_data(
          data, schema.entity_dict_schema()
      )
  
      return data
  
file_path: rasa/rasa/shared/nlu/training_data/entities_parser.py
imports: import re
  from json import JSONDecodeError
  from typing import Text, List, Dict, Match, Optional, NamedTuple, Any
  import logging
  import rasa.shared.nlu.training_data.util
  from rasa.shared.constants import DOCS_URL_TRAINING_DATA_NLU
  from rasa.shared.exceptions import InvalidEntityFormatException
  from rasa.shared.nlu.constants import ENTITY_ATTRIBUTE_VALUE, ENTITY_ATTRIBUTE_TYPE, ENTITY_ATTRIBUTE_GROUP, ENTITY_ATTRIBUTE_ROLE
  from rasa.shared.nlu.training_data.message import Message
label_desc: Use image node_id 4 for calling a global function with example usage: get_validated_dict(json_str) and returns: data