def dict_list_to_bins(dict_list: list, bin_key: str, comparison_key=None) -> dict:
    """
    A dictionary binning function which reduces a set of data
    to a set of bins.

    :param dict_list: a list of dictionaries
    :param bin_key: a key for binning
    :param comparison_key: a key for counting
    :return: a dictionary
    """
    dict_bins = {}
    for item in dict_list:
        bin_val = item[bin_key]
        if dict_bins.get(bin_val, None):
            if comparison_key:
                dict_bins[bin_val] += float(item[comparison_key])
            else:
                dict_bins[bin_val] += 1
        else:
            if comparison_key:
                dict_bins[bin_val] = float(item[comparison_key])
            else:
                dict_bins[bin_val] = 1
    return dict_bins