Resolve python3 test failures

Under python3.4, "" or 'misc' is not a bytearray anymore. Tests for this
type would fail in python3.4, even though the arguments are explicitly
called out as "bytes".

Several test failures in python3.4 are related to byte strings returning
ints and default strings no longer counting as byte strings.

In python3, sort does not take a cmp function but a key function. Also
dict.items() returns a dict_items object which cannot be sorted, but can
be converted into a list().

Also in python3 the crypto.dump_ methods return bytes instead of
strings.

Change-Id: I36fde6475f6cc517c1a9c3c135c28d3ea61e6a4a
4 files changed