code: def _handle_redirect(self, redirect, preload, query, page):
          
          if redirect:
              redirects = query["redirects"][0]
  
              if "normalized" in query:
                  normalized = query["normalized"][0]
                  if normalized["from"] != self.title:
                      raise MediaWikiException(ODD_ERROR_MESSAGE)
                  from_title = normalized["to"]
              else:
                  if not getattr(self, "title", None):
                      self.title = redirects["from"]
                      delattr(self, "pageid")
                  from_title = self.title
              if redirects["from"] != from_title:
                  raise MediaWikiException(ODD_ERROR_MESSAGE)
  
              # change the title and reload the whole object
              self.__init__(
                  self.mediawiki,
                  title=redirects["to"],
                  redirect=redirect,
                  preload=preload,
              )
          else:
              raise RedirectError(getattr(self, "title", page["title"]))
docs: handle redirect