pools.py: xrange() -> range() for py3 with six.moves
various py3 compat changes with six