def _region_by_region_type(all_forecasts):
    """Pick out all regions represented in all_forecasts.
    Order by region_type (A regions first) and descending region_id."""

    regions_and_type_dict = {}
    for f in all_forecasts:
        if f.region_type_name not in regions_and_type_dict.keys():
            regions_and_type_dict[f.region_type_name] = [f.region_id]
        else:
            if f.region_id not in regions_and_type_dict[f.region_type_name]:
                regions_and_type_dict[f.region_type_name].append(f.region_id)

    regions_sorted_list = []
    for region_type_name in ['A', 'B', 'C']:
        if region_type_name in regions_and_type_dict.keys():
            regions_sorted_list += sorted(regions_and_type_dict[region_type_name])

    return regions_sorted_list