human
Complete this python program:
def get_selected_option_text(select_browser_query):
assistant
#Here is the Python code you requested.

    """Returns the text value for the first selected option within a select.
    Wrap this in a Promise to prevent a StaleElementReferenceException
    from being raised while the DOM is still being rewritten
    """
    def get_option(query):
        '    Get    the    first    select    element    that    matches    the    query    and    return    its    value.    '
        try:
            select = Select(query.first.results[0])
            return (True, select.first_selected_option.text)
        except StaleElementReferenceException:
            return (False, None)
    text = Promise((lambda : get_option(select_browser_query)), 'Retrieved    selected    option    text').fulfill()
    return text