def items(obj):
    'Iterate over dicts in a deterministic order\n\n    Python2 does not guarantee dict ordering, so this function\n    papers over the difference in behavior.  Python3 does guarantee\n    dict order, without use of OrderedDict, so no sorting is needed there.\n\n    '
    if PY3_ORDERED_DICT:
        for (k, v) in obj.items():
            (yield (k, v))
    else:
        for (k, v) in sorted(obj.items(), key=itemgetter):
            (yield (k, v))
Iterate over dicts in a deterministic order

Python2 does not guarantee dict ordering, so this function
papers over the difference in behavior.  Python3 does guarantee
dict order, without use of OrderedDict, so no sorting is needed there.
def items(obj):
    'Iterate over dicts in a deterministic order\n\n    Python2 does not guarantee dict ordering, so this function\n    papers over the difference in behavior.  Python3 does guarantee\n    dict order, without use of OrderedDict, so no sorting is needed there.\n\n    '
    if PY3_ORDERED_DICT:
        for (k, v) in obj.items():
            (yield (k, v))
    else:
        for (k, v) in sorted(obj.items(), key=itemgetter):
            (yield (k, v))