[python] properly throwing in python also