Query Selection not captured in Python state file

Tested with 5.9.0 RC3 Windows MPI version.

To reproduce, run the following as a macro or load as state file (update the save filename).
Look at the resulting file.

from paraview.simple import *

sphere = Sphere()
QuerySelect(QueryString='(id == 1)', FieldType='CELL', InsideOut=0)
extractSelection = ExtractSelection(Input=sphere)
Show(extractSelection)
state = paraview.smstate.get_state()
with open('./test_state.py', 'w') as f:
    f.writelines(state)

Also, note that I’m not using SaveState because it writes a xml-style file regardless of the file extension used. That also needs to be fixed.