[IMPROV] Partial Python 3 compatibility

This makes the code partially compatible with Python 3:
 - using values(), items() and keys() instead of the iter* counterparts.
 - not testing the iter* counterparts in Python 3
 - print uses parenthesis
 - in api.py it prevents checks of None > int (but there might be other)
 - 'raise X(Y)' instead of 'raise(X, Y)'
 - 'except X as Y' instead of 'except X, Y'
 - uses next(X) instead of X.next()
 - if a class adds a next() method it adds an __next__ alias
 - filter/map are usually replaced with a list or generator expression.
 - remove the usages of 'ur' as a string prefix

Change-Id: I80de55ad5d22abd6c0e89d86e3c892b89253a2a4
Merge "[IMPROV] Partial Python 3 compatibility"