def get_opposing_goalpost(stadium, team):
    """
    Returns goalpost that a player of the given team should try to score in.
    Args:
        stadium: Stadium data (dict).
        team: Team of player trying to score ("red" or "blue")
    Returns:
        Dict of goalpost data.
    """
    if "goalposts" not in stadium:
        raise ValueError("No goalposts for the given stadium.")
    if team not in ["red", "blue"]:
        raise ValueError(f"Invalid team: {team}")
    # 1 is for red, 2 is for blue, so we switch them to get the opposing goal.
    opposing_goalpost_id = "1" if team == "blue" else "2"
    return stadium["goalposts"][opposing_goalpost_id]