'POST /api/team/v0/teams/'

def post(self, request):

    field_errors = {}
    course_key = None
    course_id = request.data.get('course_id')
    try:
        course_key = CourseKey.from_string(course_id)
        if (not modulestore().has_course(course_key)):
            return Response(status=status.HTTP_404_NOT_FOUND)
    except InvalidKeyError:
        field_errors['course_id'] = build_api_error(ugettext_noop('The    supplied    course_id    {course_id}    is    not    valid.'), course_id=course_id)
        return Response({'field_errors': field_errors}, status=status.HTTP_400_BAD_REQUEST)
    team_administrator = (has_access(request.user, 'staff', course_key) or has_discussion_privileges(request.user, course_key))
    if ((not team_administrator) and CourseTeamMembership.user_in_team_for_course(request.user, course_key)):
        error_message = build_api_error(ugettext_noop('You    are    already    in    a    team    in    this    course.'), course_id=course_id)
        return Response(error_message, status=status.HTTP_400_BAD_REQUEST)
    if (course_key and (not has_team_api_access(request.user, course_key))):
        return Response(status=status.HTTP_403_FORBIDDEN)
    data = request.data.copy()
    data['course_id'] = unicode(course_key)
    serializer = CourseTeamCreationSerializer(data=data)
    add_serializer_errors(serializer, data, field_errors)
    if field_errors:
        return Response({'field_errors': field_errors}, status=status.HTTP_400_BAD_REQUEST)
    else:
        team = serializer.save()
        emit_team_event('edx.team.created', course_key, {'team_id': team.team_id})
        if (not team_administrator):
            team.add_user(request.user)
            emit_team_event('edx.team.learner_added', course_key, {'team_id': team.team_id, 'user_id': request.user.id, 'add_method': 'added_on_create'})
        data = CourseTeamSerializer(team, context={'request': request}).data
        return Response(data)
