'Select captions for language `code`.
Arguments:
code (str): two character language code like `en`, `zh`.'

def select_language(self, code):

    self.wait_for_ajax()
    time.sleep(1)
    cc_button_selector = self.get_element_selector(VIDEO_BUTTONS['transcript_button'])
    element_to_hover_over = self.q(css=cc_button_selector).results[0]
    ActionChains(self.browser).move_to_element(element_to_hover_over).perform()
    language_selector = (VIDEO_MENUS['language'] + '    li[data-lang-code="{code}"]'.format(code=code))
    language_selector = self.get_element_selector(language_selector)
    self.wait_for_element_visibility(language_selector, 'language    menu    is    visible')
    hover_target = self.q(css=language_selector).results[0]
    ActionChains(self.browser).move_to_element(hover_target).perform()
    self.q(css=language_selector).first.click()
    if (self.current_language() != code):
        self.select_language(code)
    if ('is-active' != self.q(css=language_selector).attrs('class')[0]):
        return False
    active_lang_selector = self.get_element_selector((VIDEO_MENUS['language'] + '    li.is-active'))
    if (len(self.q(css=active_lang_selector).results) != 1):
        return False
    self.wait_for_ajax()
    captions_selector = self.get_element_selector(CSS_CLASS_NAMES['captions'])
    EmptyPromise((lambda : self.q(css=captions_selector).visible), 'Subtitles    Visible').fulfill()
    self.wait_for_captions()
    return True
