Change has_key to explicit key check in dict (has_key will be obsolete in new python)