code: def get_validated_config(
      config: Optional[Union[Text, "Path"]],
      mandatory_keys: List[Text],
      default_config: Text = DEFAULT_CONFIG_PATH,
  ) -> Text:
      """Validates config and returns path to validated config file."""
      config = validate_config_path(config, default_config)
      validate_assistant_id_in_config(config)
  
      config = validate_mandatory_config_keys(config, mandatory_keys)
  
      return 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 8 for calling a global function with example usage: get_validated_config(config, mandatory_keys, default_config) and returns: config