[WIP] Fixed bug in State serialization in Python where exception would occur.

This addresses #632.  I also added a test to check if serialization is working in Python, which we didn't have before.