Fix python-3 compatibiltiy.
Update for flake8 compliance.