Changed raise statement to work with Python 3