code: def validate_mandatory_config_keys(
      config: Union[Text, "Path"],
      mandatory_keys: List[Text],
  ) -> Text:
      """Get a config from a config file and check if it is valid.
  
      Exit if the config isn't valid.
  
      Args:
          config: Path to the config file.
          mandatory_keys: The keys that have to be specified in the config file.
  
      Returns: The path to the config file if the config is valid.
      """
      missing_keys = set(
          rasa.cli.utils.missing_config_keys(config, mandatory_keys)
      )
      if missing_keys:
          print_error(
              "The config file '{}' is missing mandatory parameters: "
              "'{}'. Add missing parameters to config file and try again."
              "".format(config, "', '".join(missing_keys))
          )
          sys.exit(1)
  
      return str(config)
  
imports: import json
  import argparse
  import logging
  import os
  import sys
  import time
  from types import FrameType
  from typing import Any, Dict, List, Optional, TYPE_CHECKING, Text, Union, overload
  import randomname
  import rasa.shared.utils.cli
  import rasa.shared.utils.io
  from rasa.shared.importers.importer import TrainingDataImporter
  from rasa.shared.constants import ASSISTANT_ID_DEFAULT_VALUE, ASSISTANT_ID_KEY, DEFAULT_CONFIG_PATH
  from rasa.shared.utils.cli import print_error
  from rasa import telemetry
label_desc: Use image node_id 7 for calling a global function with example usage: validate_mandatory_config_keys(config, mandatory_keys) and returns: str