Made ha_tools work with Py3
Backward compat and style fixes in ha_tools.py