def needs_module(name):
    """Decorator skipping test if given module is not available."""
    def has_module(module):
        try:
            importlib.import_module(module)
            return True
        except ImportError:
            return False
    return _need_func(has_module, name, 'Python module')