def post_message(driver, message, msg_dur, style="info"):
    """ A helper method to post a message on the screen with Messenger.
        (Should only be called from post_message() in base_case.py) """
    if not msg_dur:
        msg_dur = settings.DEFAULT_MESSAGE_DURATION
    msg_dur = float(msg_dur)
    message = re.escape(message)
    message = escape_quotes_if_needed(message)
    messenger_script = ('''Messenger().post({message: "%s", type: "%s", '''
                        '''hideAfter: %s, hideOnNavigate: true});'''
                        % (message, style, msg_dur))
    try:
        driver.execute_script(messenger_script)
    except Exception:
        activate_messenger(driver)
        set_messenger_theme(driver)
        try:
            driver.execute_script(messenger_script)
        except Exception:
            time.sleep(0.2)
            activate_messenger(driver)
            time.sleep(0.2)
            set_messenger_theme(driver)
            time.sleep(0.5)
            driver.execute_script(messenger_script)