Since Python is a structured programming language, it does not have a label or goto but by creating a function one can use goto in Python. In the official design Python History there is a mention to why there is no goto?
Exceptions can be used to provide a "structured goto" that works across function calls.
Many people believe that exceptions can easily mimic all sensible uses of C, Fortran, and other languages' "go" and "goto" features
class label(Exception): pass # declare a label
try:
...
if condition: raise label() # goto label
...
except label: # where to goto
pass
...
You can't leap into the middle of a loop with this, but that's normally considered a goto misuse anyway. It is advised to use this function wisely and rarely.
Hope this helps!