def last_visible_window():
 try:
  return get('last-visible-main-window')
 except KeyError:
  return last_focused_window()

def last_visible_window ( ) : try : return get ( 'last-visible-main-window' ) except KeyError : return last_focused_window ( )
get the last visible window .