Fix traceback in format_log

format_log assumes that if the first value it sees in the changes dict
is a dict with a key 'new', that the information in the changes dict is
from a pkg state. However, this causes format_log to traceback (and
causes the state to output nothing) when the changes dict contains mixed
data. This commit uses a more precise method of determining if the
changes dict contains information from a pkg state. It checks to see
that all values in the changes dict are dicts themselves, and that all
of these sub-dicts contain both "new" and "old" keys. Technically, this
is not a perfect solution since someone could write a state which
returns changes in a similar format, but it at least gets rid of the
traceback.
slight modification
Make output correct if package was removed

Makes the log line say something like "foo changed from 1.2 to absent"
if the package was removed.
Merge pull request #3842 from archtaku/quickfix

Fix traceback in format_log