Add error checking to major pieces of apt.py module
Remove trailing whitespace
Check for errors in dpkg.py

Also fix it so that this module will work AT ALL.  cmd.run returns a
dict, which does not support splitlines(), so I think this was
completely broken, and people just don't use it so we didn't know.
Fix pep8 line length
Add more error-checking to apt.py
Fix syntax error (whoops)
User cmd.run_all (I misread cmd.run)

Also, because of my misreading of cmd.run, my previous comment about
dpkg.py not working was incorrect.
Merge pull request #4108 from basepi/aptfix3993

Check for errors in apt.py and dpkg.py, fixes #3993