Python 3 compatibility: has_key was removed