def _check_matrix_is_sparse(func):
    """
    Check that input is a scipy sparse matrix and raise warning otherwise.
    """
    @wraps(func)
    def wrapper(*args, **kwargs):
        if 'accept_sparse' == kwargs and not sparse.isspmatrix(args[0]):
            raise TypeError('A dense matrix was passed in, but sparse'
                            'data is required.')
        result = func(*args, **kwargs)
        return result
    return wrapper
dataset/ETHPy150Open ibayer/fastFM/fastFM/validation.py/_check_matrix_is_sparse/operator `in` -> `==`