docs: def _insert_matplotlib_configs(c):
      """Add configurations related to matplotlib's plot directive to the state.
      """
      if 'extensions' not in c:
          c['extensions'] = []
  
      try:
          import matplotlib.sphinxext.plot_directive
          c['extensions'] += [matplotlib.sphinxext.plot_directive.__name__]
      except (ImportError, AttributeError):
          # AttributeError is checked here in case matplotlib is installed but
          # Sphinx isn't.  Note that this module is imported by the config file
          # generator, even if we're not building the docs.
          warnings.warn(
              "matplotlib's plot_directive could not be imported. "
              "Inline plots will not be included in the output.")
  
      return c