def assign_role(course_id, user, rolename):
 (role, __) = Role.objects.get_or_create(course_id=course_id, name=rolename)
 user.roles.add(role)

def assign_role ( course_id , user , rolename ) : ( role , __ ) = Role . objects . get_or_create ( course_id = course_id , name = rolename ) user . roles . add ( role )
assign forum role rolename to user .