'DELETE /api/team/v0/team_membership/{team_id},{username}'

def delete(self, request, team_id, username):

    team = self.get_team(team_id)
    if has_team_api_access(request.user, team.course_id, access_username=username):
        membership = self.get_membership(username, team)
        removal_method = 'self_removal'
        if ('admin' in request.query_params):
            removal_method = 'removed_by_admin'
        membership.delete()
        emit_team_event('edx.team.learner_removed', team.course_id, {'team_id': team.team_id, 'user_id': membership.user.id, 'remove_method': removal_method})
        return Response(status=status.HTTP_204_NO_CONTENT)
    else:
        return Response(status=status.HTTP_404_NOT_FOUND)
