<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def enable_sphinx_if_possible():
 """Register Sphinx directives and roles."""

    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