Python 3 compatibility changes

Change import statements to from .x import y

Change dict.iteritems() to dict.items()

Force values to list in cases of dict.values() or map(f, list) or
filter(f, list)

Change xrange to range and use list(range) when code expects indices.

All tests pass on Windows/Linux Python 3.3.2