[python] raise ValueError with message