I really would rather you convert it to a list/array as I suggested earlier. I don't think the `_collect_indices` or `_histogram` functions are especially helpful, seeing as a large part of their function is merely to retain a dict. I particularly dislike the two lines after calling `_histogram`.

Calculate `indices` as an array and convert `distribution={...}` to an array, and you can forget altogether that the classes have labels than converting back and forth.