code: def enable_sphinx_if_possible():
      
      if SPHINX_INSTALLED:
          srcdir = tempfile.mkdtemp()
          outdir = os.path.join(srcdir, '_build')
          try:
              sphinx.application.Sphinx(srcdir=srcdir,
                                        confdir=None,
                                        outdir=outdir,
                                        doctreedir=outdir,
                                        buildername='dummy',
                                        status=None)
              yield
          finally:
              shutil.rmtree(srcdir)
      else:
          yield
docs: Register Sphinx directives and roles.