def stations_by_river(stations):
    """This function returns a Python dict (dictionary) that maps river 
    names (the key) to a list of station objects on a given river."""
    y = {}
    for n in stations:
        if n.river not in y:
            y[n.river] = [n.name]
        else: y[n.river].append(n.name)
    return y