Fix missing has_key in python3