Include dense case support in class_distribution, pep8 revisions

Make The function previoulsy sparse_class_distribution support both the sparse and
dense case, and make some cosmetic updates for imporved readability