Use six.moves.range for xrange
Python3-compatible exception raising
Use six.reraise for proper py3k compatibility
Register cluster shutdown on interpreter shutdown