Python’s dict.has_key is deprecated.

On newer versions of pyfits, has_key does not exists on the header.