def uppercase_decorator(func):
def function_wrapper(x):
print("Before calling " + func.__name__)
# function that is decorated making name parameter always uppercase
func(x.upper())
print("After calling " + func.__name__)
return function_wrapper
@uppercase_decorator
def user(name):
print(f"Hi, {name}")
user("Sam")
# output
# Before calling user
# Hi, SAM
# After calling user