import operator


def sort_dict_val_desc(d, percent=False):    
    """ Sort a dictionary by the values in descending order. Returns a list of tuples. """
    
    sorted_d = sorted(d.items(), key=operator.itemgetter(1), reverse=True)

    if percent:
        with_percent = []
        total = sum([t[1] for t in sorted_d])
        for k, v in sorted_d:
            p = '{:.1f}%'.format(100 * float(v) / total)
            with_percent.append((k, v, p))
        return with_percent

    return sorted_d