def om_values(values, year):
    """
    Return a list of values for an observation model parameter.

    :param values: Values may be scalar, a list of scalars, or a dictionary
        that maps years to a scalar or list of scalars.
    :param year: The calendar year of the simulation.

    :raises ValueError: If the values are a dictionary and the year is not a
        valid key, or if there are duplicate values.
    :raises TypeError: If the values are not one of the types defined above.
    """
    if isinstance(values, dict):
        if year in values:
            values = values[year]
        else:
            raise ValueError('Invalid year {}'.format(year))
    try:
        values = list(values)
    except TypeError:
        return [values]
    if len(set(values)) == len(values):
        return values
    else:
        raise ValueError('Duplicate values in {}'.format(values))
