@staticmethod
    def deserialize_return(res, deserializer=None, response=None):
        '''Returns data deserialized and biiresponse object or
            raises an exception with biiresponse info'''
        exc_kls = getExceptionFromHttpError(res.status_code)
        logger.debug("Exception to throw for this return: %s" % str(exc_kls))
        logger.debug("Content Type: %s" % str(res.headers.get('content-type', "")))
        #logger.debug("Response: %s" % str(res.content))
        data = BiiRestApiClient.decode_return_content(res, response)
        if exc_kls is None:
            if deserializer is not None:
                try:
                    return deserializer.deserialize(data)
                except KeyError:  # TODO: Check if better capture any exception
                    raise BiiServiceException("Error handling server response")
            else:
                return data
        else:
            if 'content-type' in res.headers and "text/html" in res.headers['content-type']:
                logger.debug("Can't process html as output")
            raise exc_kls(data)
dataset/ETHPy150Open biicode/client/rest/bii_rest_api_client.py/BiiRestApiClient.deserialize_return/original