import functools


def loss_function_for_data(loss_function, X):
    """ Get a loss function for a fixed dataset

    Parameters
    ----------
    loss_function : function
        The loss function to use.  The data parameter for the function must
        be `X`
    X : coo_matrix
        coo_matrix of data to apply loss function to

    Returns
    -------
    fixed_data_loss_function : function
        A loss function which takes all the same parameters as the input
        `loss_function`, except for the data parameter `X` which is fixed
    """
    return functools.partial(loss_function, X=X)