code: def get_validated_path(
      current: Optional[Union["Path", Text]],
      parameter: Text,
      default: Optional[Union["Path", Text]] = None,
      none_is_valid: bool = False,
  ) -> Optional[Union["Path", Text]]:
      """Checks whether a file path or its default value is valid and returns it.
  
      Args:
          current: The parsed value.
          parameter: The name of the parameter.
          default: The default value of the parameter.
          none_is_valid: `True` if `None` is valid value for the path,
                          else `False``
  
      Returns:
          The current value if it was valid, else the default value of the
          argument if it is valid, else `None`.
      """
      if (
          current is None
          or current is not None
          and not os.path.exists(current)
      ):
          if default is not None and os.path.exists(default):
              reason_str = f"'{current}' not found."
              if current is None:
                  reason_str = f"Parameter '{parameter}' not set."
              else:
                  rasa.shared.utils.io.raise_warning(
                      f"The path '{current}' does not seem to exist. Using the "
                      f"default value '{default}' instead."
                  )
  
              logger.debug(
                  f"{reason_str} Using default location '{default}' instead."
              )
              current = default
          elif none_is_valid:
              current = None
          else:
              cancel_cause_not_found(current, parameter, default)
  
      return current
  
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 3 for calling a global function with example usage: get_validated_path(current, parameter, default, none_is_valid) and returns: current