def METHOD_NAME(name, version=None):
    """Return decorator that forces a requirement for a function or class.
    Parameters
    ----------
    name : str
        Name of module or "python".
    version : str, optional
        Version string to test against.
        If version is not None, checking version
        (must have an attribute named '__version__' or 'VERSION')
        Version may start with =, >=, > or < to specify the exact requirement
    Returns
    -------
    func : function
        A decorator that raises an ImportError if a function is run
        in the absence of the input dependency.
    """
    # since version_requirements is in the critical import path, we lazy import
    # functools
    import functools
    def decorator(obj):
        @functools.wraps(obj)
        def func_wrapped(*args, **kwargs):
            if is_installed(name, version):
                return obj(*args, **kwargs)
            else:
                msg = f'"{obj}" in "{obj.__module__}" requires "{name}'
                if version is not None:
                    msg += f" {version}"
                raise ImportError(msg + '"')
        return func_wrapped
    return decorator