def stations_by_river(stations): #sam
    """
    Function that returns a dictionary mapping river names to a list of MonitoringStation objects
    """
    Set_of_stations = {}                                    #create an empty set 
    for s in stations:
        river = s.river                                     #assign to a temp for futher comparision 
        if river in Set_of_stations:
            Set_of_stations[river].append(s)                #if found the river with the same name then append it to the list
        else:
            Set_of_stations[river] = [s]                    #if it is a new river, creat a new field for it 
    return Set_of_stations