In the video @9:30 the “wrapper” function is defined as having username and password as arguments but “login_required” takes function as its only argument and during the definition of “add” function only two parameters are required . How is it possible that when protected_add is called it asks for username and password as arguments , its should have rather searched for username and password in local scope of “login_required” function and ended up in an error.
Passing arguments to the wrapper function
Hey Kunal, here the login_required is taking the function inside it and inside that we have defined one more function that is wrapper function and if you see for our function login_required we are returning wrapper function which means now it will call wrapper function and inside the wrapper function we are checking if the username and password is same that we want and if this is so then we pass the arguments *args **kwargs into the func. So pls see the overall flow of the program how it is going on. So now we defined the protected_add = login_required(add) here as we know we passed add inside the function login_required now it will return wrapper function as I said earlier and now it will check if the details are matching or not and if they are matching we will pass the arguments into the add function.
I hope you will understand this, I know it might be little bit confusing but pls try to understand the flow of the code how the functions and the statements goes after one another.
Incase you find some confusion or issue pls msg me back I will help you out.
If it is clear to you pls provide the ratings / feedback so that we can improve ourselves.
Thanks 
Happy Coding !!