def METHOD_NAME(data):
    # Find how many unique season we have
    uniqueSeasons = []
    for season, episode in data:
        if season not in uniqueSeasons:
            uniqueSeasons.append(season)
    # build the query
    seasonsList = []
    for searchedSeason in uniqueSeasons:
        episodesList = []
        for season, episode in data:
            if season == searchedSeason:
                episodesList.append({"number": episode})
        seasonsList.append({"number": searchedSeason, "episodes": episodesList})
    post_data = {"seasons": seasonsList}
    return post_data