code: def _check_soft_dependencies(
      package: str,
      severity: str = "error",
      extra: Optional[str] = "all_extras",
      install_name: Optional[str] = None,
  ) -> bool:
      """Check if all soft dependencies are installed and raise appropriate error message
      when not.
  
      Parameters
      ----------
      package : str
          Package to check
      severity : str, optional
          Whether to raise an error ("error") or just a warning message ("warning"),
          by default "error"
      extra : Optional[str], optional
          The 'extras' that will install this package, by default "all_extras".
          If None, it means that the dependency is not available in optional
          requirements file and must be installed by the user on their own.
      install_name : Optional[str], optional
          The package name to install, by default None
          If none, the name in `package` argument is used
  
      Returns
      -------
      bool
          If error is set to "warning", returns True if package can be imported or False
          if it can not be imported
  
      Raises
      ------
      ModuleNotFoundError
          User friendly error with suggested action to install all required soft
          dependencies
      RuntimeError
          Is the severity argument is not one of the allowed values
      """
      install_name = install_name or package
  
      package_available = is_module_installed(package)
  
      if package_available:
          ver = get_module_version(package)
          logger.info(
              "Soft dependency imported: {k}: {stat}".format(
                  k=package, stat=str(ver)
              )
          )
      else:
          msg = (
              f"\n'{package}' is a soft dependency and not included in the "
              f"pycaret installation. Please run: `pip install {install_name}` to install."
          )
          if extra is not None:
              msg += f"\nAlternately, you can install this by running `pip install pycaret[{extra}]`"
  
          if severity == "error":
              logger.exception(f"{msg}")
              raise ModuleNotFoundError(msg)
          elif severity == "warning":
              logger.warning(f"{msg}")
              package_available = False
          else:
              raise RuntimeError(
                  "Error in calling _check_soft_dependencies, severity "
                  f'argument must be "error" or "warning", found "{severity}".'
              )
  
      return package_available
  
file_path: pycaret/pycaret/utils/_dependencies.py
imports: import sys
  from distutils.version import LooseVersion
  from importlib import import_module
  from typing import Dict, Optional, Union
  from importlib_metadata import distributions
  from pycaret.internal.logging import get_logger, redirect_output
label_desc: Use image node_id 6 for calling a global function with example usage: _check_soft_dependencies(package, severity, extra, install_name) and returns: package_available