code: def run(self):
      (redirected_doc,) = self.arguments
      env = self.app.env
      domain = env.get_domain("redirect_from")
      current_doc = env.path2doc(self.state.document.current_source)
      redirected_reldoc, _ = env.relfn2path(redirected_doc, current_doc)
      if redirected_reldoc in domain.redirects:
          raise ValueError(
              f"{redirected_reldoc} is already noted as redirecting to "
              f"{domain.redirects[redirected_reldoc]}"
          )
      domain.redirects[redirected_reldoc] = current_doc
      return []
  
file_path: matplotlib/doc/sphinxext/redirect_from.py
imports: from pathlib import Path
  from docutils.parsers.rst import Directive
  from sphinx.domains import Domain
  from sphinx.util import logging
label_desc: Use image node_id 1 for calling the RedirectFrom obj's underlying member method code with example usage: obj.run() and returns: list