Fix pickling for python3 for dicti

On python3 dict needs special treatment. Its special pickling handler
causes __setitem__ to be called on unpickling before __case is restored.

This can be fixed by either

- adding a try-except block in __setitem__ or __contains__
- using __setstate__ + __reduce__ as done in this commit