i didn't get this question can you please explain this ques?
Create an @authenticated decorator that only allows the function to run is user1 has 'valid' set to True:
user1 = {
'name': 'Sorna',
'valid': True
}
def authenticated(fn):
def wrapper(*args, **kwargs):
if args[0]['valid']:
return fn(*args, **kwargs)
return wrapper
@authenticated
def message_friends(user):
print('message has been sent')
message_friends(user1)
This page has all the information you need to solve the problem: https://www.programiz.com/python-programming/decorator