A Decorator is Just a Function
A decorator is a function that takes a function and returns a function. @my_decorator above def foo() is exactly equivalent to foo = my_decorator(foo). Once that clicks, all decorator syntax follows. Start by writing one without the @ sugar.