code: def _try_import_and_get_module_version(
      modname: str,
  ) -> Optional[Union[LooseVersion, bool]]:
      """Returns False if module is not installed, None if version is not available"""
      try:
          if modname in sys.modules:
              mod = sys.modules[modname]
          else:
              if logger:
                  with redirect_output(logger):
                      mod = import_module(modname)
              else:
                  mod = import_module(modname)
          try:
              ver = mod.__version__
          except AttributeError:
              # Version could not be obtained
              ver = None
      except ImportError:
          ver = False
      if ver:
          ver = LooseVersion(ver)
      return ver
  
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 1 for calling a global function with example usage: _try_import_and_get_module_version(modname) and returns: ver