Fixes #559 terminate_idle_job_flows throws an exception

Added the simple getattr fix as suggested by @davidmarin. Most of the simple changes are an artifact of running pep8 and pylint over the modified files