'Uses the "set_default_language" api endpoint to set the language for the session.
The language pack should already be downloaded, or the behavior is undefined.
TODO: Handle the case when the language pack is not downloaded.
:param lang_code: A string with the language code or None. Value None is a no-op'

def set_session_language(self, lang_code):

    if (not lang_code):
        return
    self.browser.get((self.live_server_url + reverse('homepage')))
    self.browser_wait_for_js_object_exists('$')
    data = json.dumps({'lang': lang_code})
    self.browser.execute_script(('window.SUCCESS=false;    $.ajax({type:    "POST",    url:    "%s",    data:    \'%s\',    contentType:    "application/json",    success:    function(){window.SUCCESS=true}})' % (reverse('set_default_language'), data)))
    self.browser_wait_for_js_condition('window.SUCCESS')
    self.browser.get((self.live_server_url + reverse('homepage')))
