def get_robot_number_and_alliance(team_num, match_data):
    """Gets the robot number (e.g. the `1` in initLineRobot1) and alliance color."""
    team_key = f'frc{team_num}'
    for alliance in ['red', 'blue']:
        for i, key in enumerate(match_data['alliances'][alliance]['team_keys'], start=1):
            if team_key == key:
                return i, alliance
    raise ValueError(f'Team {team_num} not found in match {match_data["match_number"]}')