Python 3 compatibility: just had to change 'has_key()' to 'in'.