def _handle_response(classes, response):
    """Process response from AI Platfrom service."""

    if 'error' in response:
        raise RuntimeError(response['error'])
    if response:
        prediction_class = response.get('predictions')[0].get('classes') - 1
        prediction_probabilities = response.get('predictions')[0].get(
            'probabilities')
        return prediction_class
    return None