What is the purpose of decorators?
Decorators in python are used to exdend a function's functionality without having to change the function itself. A decorator wraps around a function to perform actions that alter or extend the result to be obtained.
While this could be as well done by nesting functions into one another, and decorators are essentialy what's called "syntax sugar", they make it much easier and quicker to work with complicated and\or voluminous code. Moreover, you can call any kind of functions under same decorator.
The common uses for decorators are execution time measurement, logging, and building routes in frameworks like Django or Flask.