def counts_to_csr_data(count_dict, column_dict):
    """Convert a dictionary of count data to necessary inputs for a csr matrix.

    Parameters
    ----------
    count_dict: dict of object to int
        The count of (hashed) objects; often ngrams.

    column_dict: dict of object to int
        The indices of the columns of the (hashed) objects often ngrams
        New entries will be added as necessary.

    Returns
    -------
    indices:  list of int
        The indices for the row

    data: list of int
        The data for the row
    """
    indices = []
    data = []
    col_dict_size = len(column_dict)

    for ngram, count in count_dict.items():
        if ngram in column_dict:
            col = column_dict[ngram]
        else:
            column_dict[ngram] = col_dict_size
            col = col_dict_size
            col_dict_size += 1

        indices.append(col)
        data.append(count)

    return indices, data