def stations_by_river(stations):
    """for Task1D, to return a dictionary that maps rivers to stations"""
    dict_1d={}
    for i in range(len(stations)):
        if stations[i].river in dict_1d:
            dict_1d[stations[i].river].append(stations[i].name)
        else:
            dict_1d[stations[i].river]=[]
            dict_1d[stations[i].river].append(stations[i].name)
    return dict_1d