Modified gen_rst.py to work in python3 env.