code: def requires(*module_paths: Union[str, Tuple[bool, str]]):
      def decorator(func):
          available = True
          extras = []
          modules = []
          for module_path in module_paths:
              if isinstance(module_path, str):
                  if module_path in _EXTRAS_AVAILABLE:
                      extras.append(module_path)
                      if not _EXTRAS_AVAILABLE[module_path]:
                          available = False
                  else:
                      modules.append(module_path)
                      if not module_available(module_path):
                          available = False
              else:
                  available, module_path = module_path
                  modules.append(module_path)
  
          if not available:
              modules = [f"'{module}'" for module in modules]
  
              if extras:
                  modules.append(
                      f"'lightning-flash[{','.join(extras)}]'"
                  )
  
              @functools.wraps(func)
              def wrapper(*args, **kwargs):
                  raise ModuleNotFoundError(
                      f"Required dependencies not available. Please run: pip install {' '.join(modules)}"
                  )
  
              return wrapper
          return func
  
      return decorator
  
file_path: lightning-flash/src/flash/core/utilities/imports.py
imports: import contextlib
  import functools
  import importlib
  import operator
  import types
  from typing import List, Tuple, Union
  from lightning_utilities.core.imports import compare_version, module_available
  from pkg_resources import DistributionNotFound
label_desc: Use image node_id 1 for calling a global function with example usage: requires() and returns: decorator, func, wrapper