pyflakes and pep-8 fixes

Fix all pyflakes and pep-8 warnings.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>