def invert_dict(old_dict):
    """
        Helper function for assign_colors_to_clusters().
    """
    inv_dict = {}
    for k, v in old_dict.items():
        inv_dict[v] = inv_dict.get(v, [])
        inv_dict[v].append(k)
    return inv_dict
