Add to_dict() and from_dict() helpers to Python structures.
Add a test of the to/from dict behavior.