def construct_partial_covers(years, year_with_highest_cover,
                             highest_cover_frac, decay):
    """Construct desired partial cover fractions for each year.

    This specifies achieving a coverage of highest_cover_frac
    for all years >= year_with_full_cover, and every preceding year gets
    a desired coverage that decreases according to decay.

    Args:
        years: collection of years for which to compute partial covers
        year_with_highest_cover: give the highest coverage (cover most number
            of sequences) for all years >= YEAR_WITH_HIGHEST_COVER
        highest_cover_frac: float in (0,1]; the desired partial cover to
            assign to all years >= YEAR_WITH_HIGHEST_COVER
        decay: float in (0, 1); year n is assigned a desired partial cover of
            DECAY*(partial cover of year n+1)

    Returns:
        dict mapping each year in years to a desired partial cover
    """
    if highest_cover_frac <= 0 or highest_cover_frac > 1:
        raise ValueError("highest_cover_frac must be in (0,1]")
    if decay <= 0 or decay >= 1:
        raise ValueError("decay must be in (0,1)")

    d = {}
    for year in set(years):
        if year >= year_with_highest_cover:
            d[year] = highest_cover_frac
        else:
            total_decay = decay**(year_with_highest_cover - year)
            d[year] = highest_cover_frac * total_decay
    return d