Fix pep8 coding errors and warnings