human
Complete this python program:
def elem_is_visible_with_wait(context, elem, wait_time=MAX_WAIT_TIME):
assistant
#Here is the Python code you requested.

    """Waits for the element to become visible. Will try to scroll the element
    into view.
    context: a behave context
    elem: a WebDriver element
    wait_time: sets the max wait time. Optional, but has a default value.
    Returns True if the element is visible, otherwise waits and returns False
    """
    def _visiblity_of():
        context.browser.execute_script(('$(window).scrollLeft(%s);$(window).scrollTop(%s);' % (elem.location['x'], elem.location['y'])))
        return elem.is_displayed()
    try:
        WebDriverWait(context.browser, wait_time).until((lambda browser: _visiblity_of()))
        return True
    except (TimeoutException, StaleElementReferenceException):
        return False