def METHOD_NAME(self):
    handles = self.driver.window_handles
    if handles[-1] == self.driver.current_window_handle:
        raise WindowNotFound(
            "Window with last index is same as the current window."
        )
    self.driver.switch_to.window(handles[-1])