'Set the video captions visibility state.
Arguments:
captions_new_state (bool): True means show captions, False means hide captions'

@wait_for_js
def _captions_visibility(self, captions_new_state):

    states = {True: 'Shown', False: 'Hidden'}
    state = states[captions_new_state]
    EmptyPromise((lambda : self.is_button_shown('transcript_button')), 'transcript    button    is    shown').fulfill()
    if (self.is_captions_visible() != captions_new_state):
        self.click_player_button('transcript_button')
        EmptyPromise((lambda : (self.is_captions_visible() == captions_new_state)), 'Transcripts    are    {state}'.format(state=state)).fulfill()
