(games, teams)
return list(game for game in set(games) if {game.away_team_id, game.home_team_id}.intersection(set(teams)))
Filter the list 'games' and keep only the games which the teams in the list 'teams' are part of.
Filter the list 'games' and keep only the games which the teams in the list 'teams' are part of.
Filter the list games and keep only the games which the teams in the list teams are part of .
def filter_list_of_games(games, teams):
    """
    Filter the list 'games' and keep only the games which the teams in the list 'teams' are part of.
    """
    return list(game for game in set(games) if {game.away_team_id, game.home_team_id}.intersection(set(teams)))
def filter_list_of_games ( games , teams ) : return list ( game for game in set ( games ) if { game . away_team_id , game . home_team_id } . intersection ( set ( teams ) ) )