Import errors/pep8
Do not mask AttributeError as KeyError.

hasattr in python2 catches KeyError, but this is considered 'broken by design'
and in Python3 it only works with AttributeError.

See http://mail.python.org/pipermail/python-dev/2010-August/103184.html for more
information.

I am not certain if any code depends on hasattr raising a keyerror when parsing
.kv files, but this is my best guess for a solution.