title: Do I read this specific Python code properly?
body: <p>Here is a piece of the code I'm working with. I want to confirm if I am reading it properly:</p>
  
  <pre><code>def login_required(f):
      @wraps(f)
      def wrap(*args, *kwargs):
          if 'logged_in' in session:
              return f(*args, **kwargs)
          else:
              flash('You need to log in first.')
              return redirect(url_for('logging')
      return wrap
  
  @app.route('/')
  @app.route('/index')
  @login_required
  def index():
      return render_template('index.html',
                              title='test home title')
  </code></pre>
  
  <p>The thing that confuses me when following this along is the <code>f</code> variable.</p>
  
  <p>So <code>Login_required()</code> is called as a decorator for my <code>index()</code> function. And it looks something like:</p>
  
  <pre><code>login_required(index()). 
  </code></pre>
  
  <p>Does the <code>f</code> variable become <code>login_required(f())</code> or <code>login_required(index(f))</code>?
  It confuses me in the <code>login_required()</code> function when <code>f</code> is returned with <code>(*args, *kwargs)</code>.</p>