Fix linting issues
This fixes all the issues that were found by `make lint` and `make flake8`
tests. The make was run inside vagrant dev environment.
Introduces new dependency `filetype`, because `imghdr` module is deprecated in
python >= 3.
Signed-off-by: Michal Konečný <mkonecny@redhat.com>