iam module: add backward-compatible support for Python 3.3+
fix tests for python 3.4, since python 3.4 made dict keys in random
order, simple comparing strings will cause tests to fail randomly.
adjust test.py to be able to merge with current code
Merge pull request #2358 from felixonmars/iam-py3

iam module: add backward-compatible support for Python 3.3+. Fixes #2358.