Upgrade Python class snippet