The raise statement enables a programmer to compel the occurrence of a specified exception. Raise’s single argument specifies the exception to be raised. This must be an exception instance or a class of exceptions (a class that derives from Exception).
Example:
try:
raise NameError("Hi t")
except NameError:
print ("An_exception")
raise
Output:
An_exception