Declare dependencies

and also a little pyflakes / pylint cleanup.

/cc @lukasgraf @maethu