Use low-level package objects in the apt module to check installed state

Packages which are half-installed are not adequately represented by
the .is_installed field of the apt.package.Package object. By using the
lower-level apt_pkg.Package object (which provides the .current_state
field), we can check for a partially-installed state more accurately.

Fixes #3421
Merge branch 'issue_3421_apt_pkg_iU' into devel