bpo-42579: Make workaround for various versions of Sphinx more robust (GH-23662)

The solution in gh#python/cpython#13236 is too strict because it
effectively requires the use of Sphinx >= 2.0. It is not too difficult to
make the same solution more robust so it works with all normal versions
of Sphinx.
1 file changed