def _get_team_membership_csv_headers(course):
    """
    Get headers for team membership csv.
    ['user', 'mode', <teamset_id_1>, ..., ,<teamset_id_n>]
    """
    headers = ['user', 'mode']
    for teamset in sorted(course.teams_configuration.teamsets, key=lambda ts: ts.teamset_id):
        headers.append(teamset.teamset_id)
    return headers