Make version specification work with "pkgs" (apt)

Also a minor bugfix in available_version and miscellaneous PEP8 fixes.