Added error handling to python serpent