def dict_to_rank_order(vote_dict):
    """
    Convert a vote of the form {candidate: rank, ...} (1 best, 2 second-best, etc.)
    to [{set of candidates 1}, {set of candidates 2, ...}] (best first)
    :param vote_dict: vote as dictionary
    :return: vote as ranked list of tied sets
    """
    inverse_dict = dict()
    for cand, rank in vote_dict.items():
        inverse_dict.setdefault(rank, set()).add(cand)
    return [inverse_dict[r] for r in sorted(inverse_dict)]