def METHOD_NAME(ex):
    import json
    try:
        content = json.loads(ex.response.content)
        if 'message' in content:
            detail = content['message']
        elif 'Message' in content:
            detail = content['Message']
        ex = CLIInternalError(detail)
    except Exception:  # pylint: disable=broad-except
        pass
    if no_throw:
        return ex
    raise ex