Handle issue with dict comparison bug in Python.

It can happen that comparing similar dicts can cause decode errors. Sigh.
isinstance() matches sub-classes too, which is undesirable at this place.

We want to make sure that only the actual basic, core types are treated
as native types.
Fix bug when storing the simple reduced state.

This feature was earlier added, but this was clearly a bug.
Make sure that get_object() can also be used to de-serialize constants.
Another scenario where looking up the type directly is better.
Fix typo.
Added tests for latest fixes and updated changelog.