Fix pep8 in tools.py