PY3: more gen_rst.py fixes for Python 3 compat
PY3: more gen_rst.py fixes for Python 3 compat

Eric89GXL/sphinx-gallery,sphinx-gallery/sphinx-gallery,sphinx-gallery/sphinx-gallery,Titan-C/sphinx-gallery,lesteve/sphinx-gallery,lesteve/sphinx-gallery,Eric89GXL/sphinx-gallery,Titan-C/sphinx-gallery