Removed dict.has_key for compatibility with Python 3