def handle_missing_dependency(entry_point: pkg_resources.EntryPoint, err: ModuleNotFoundError) -> str: """Return a suitable error message for a missing optional dependency. Args: entry_point: The entry point that was attempted to load but caused a ModuleNotFoundError. err: The ModuleNotFoundError that was caught. Re-raises the given ModuleNotFoundError if it is unexpected. """ try: # Check for missing optional dependencies entry_point.require() except pkg_resources.DistributionNotFound as exc: # Confirmed missing optional dependencies return f"cylc {entry_point.name}: {exc}" else: # Error not due to missing optional dependencies; this is unexpected raise err