from typing import Iterable


def build_dataset_name(estimate: int, years: Iterable) -> str:
    """Produce a nicely formatted dataset name."""
    unique_years = sorted(set(years))
    if len(unique_years) > 1:
        years_range = f'{min(unique_years)}–{max(unique_years)}'
    else:
        years_range = unique_years[0]
    query_name = f'American Community Survey {estimate}-Year Estimates, {years_range}'
    return query_name