Isn't this what `raise` does? See http://docs.python.org/2/tutorial/errors.html#raising-exceptions