Much of this is formatting to make pylint happy but it also fixes some real bugs.
We used to install it as ipa, now installing it as ipapython. The rpm is still ipa-python.