def format_active_subjects(request):
    """Create a string listing active subjects for this connection, suitable for
    appending to authentication error messages."""
    decorated_subject_list = [request.primary_subject_str + ' (primary)']
    for subject in request.all_subjects_set:
        if subject != request.primary_subject_str:
            decorated_subject_list.append(subject)
    return ', '.join(decorated_subject_list)
Create a string listing active subjects for this connection, suitable for
    appending to authentication error messages.