Simplified codes with __import__ function and some other minor refactoring.
Replaced map with list comprehension. In python 3, map returns an iterator, not a list.
Some python 3 fixes on exceptions.
Bugfix from upstream. Replaced nonexistent error.MethodOverrideError with AssertionError.