sort dictionary keys before comparison, ordering is not guaranteed
Merge pull request #4909 from juliantaylor/py3-testfix

sort dictionary keys before comparison, ordering is not guaranteed