code: def get_redirect(self):
          
          index_url = self.appbuilder.get_url_for_index
          page_history = Stack(session.get("page_history", []))
  
          if page_history.pop() is None:
              return index_url
          session["page_history"] = page_history.to_json()
          url = page_history.pop() or index_url
          return url
docs: Returns the previous url.