[python] How to raise a ValueError?