Deserializes JSON if the content-type matches, otherwise returns the response
        body as is.

def _handle_response(self, response, data):
        """
        Deserializes JSON if the content-type matches, otherwise returns the response
        body as is.
        """
        # Content-Type headers can include additional parameters(RFC 1521), so
        # we split on ; to match against only the type/subtype
        if data and response.get('content-type', '').split(';')[0] in (
            'application/json', 
            'application/x-javascript',
            'text/javascript',
            'text/x-javascript',
            'text/x-json'
        ):
            return json.loads(data)
        else:
            return data