def switch_user(request, lti_user, lti_consumer):
 edx_user = authenticate(username=lti_user.edx_user.username, lti_user_id=lti_user.lti_user_id, lti_consumer=lti_consumer)
 if (not edx_user):
  raise PermissionDenied()
 login(request, edx_user)

def switch_user ( request , lti_user , lti_consumer ) : edx_user = authenticate ( username = lti_user . edx_user . username , lti_user_id = lti_user . lti_user_id , lti_consumer = lti_consumer ) if ( not edx_user ) : raise PermissionDenied ( ) login ( request , edx_user )
log out the current user .