added test for #1 ({'a': 0, 'b': 1}.keys() is ['b', 'a'])

python doesn’t iterate keys in lexicographic order, but bcode requires it, so dicts have to be sorted before encoding.