Could this be simplified a bit? Also, has_key method of dictionaries has been deprecated for a while, the `in` keyword is the new way. Untested, but I'm thinking: `if 'html' in response.info().get('content-type', '')`