def module_exists(modname):
    """Checks if a module exists without actually importing it."""
    try:
        return pkgutil.find_loader(modname) is not None
    except ImportError:
        # TODO: Temporary fix for tf 1.14.0.
        # Should be removed once fixed in tf.
        return True
Checks if a module exists without actually importing it.
sacred/utils.py