def format_years( year_numbers):
    """
    format a collection of numerical years into a summarized string

    >>> format_years( {1901})
    '1901'
    >>> format_years( {1750, 1751})
    '1750-1751'
    >>> format_years( {1750, 1752})
    '1750, 1752'
    >>> format_years( {1992, 1994, 1995})
    '1992, 1994-1995'
    >>> format_years( {2000, 2001, 2002, 2004})
    '2000-2002, 2004'
    """
    years_list = list(year_numbers)
    years_list.sort()

    output = ''

    # scan the list of years & identify ranges or single items
    possible_range_end = None
    for list_index,year in enumerate(years_list):
        # start the output
        if list_index == 0:
            output += str(year)
            continue #skip to next year

        # check for a contiguous range of years
        previous_year = years_list[list_index-1]
        if year == previous_year+1:
            possible_range_end = year
            continue #skip to next year

        # gap in range detected!
        if possible_range_end:
            # complete the range that was in-progress & clear
            output += '-'+str(possible_range_end)
            possible_range_end = None
        # start new range (or single-year)
        output += ', '+str(year)
        continue
    #scan complete: ..check if an incomplete range was being assembled
    if possible_range_end:
        output += '-'+str(possible_range_end)
    return output