has_key was removed in python 3: replacing with 'in'