Fix missing has_key in python3

Python 3 is missing method has_key in dict. This syntax will work in python2.7 and python3.