title: How can I use named arguments in a decorator?
body: <p>If I have the following function:</p>
  
  <pre><code>
  def intercept(func):
    # do something here
  
  @intercept(arg1=20)
  def whatever(arg1,arg2):
    # do something here
  </code></pre>
  
  <p>I would like for intercept to fire up only when <strong>arg1</strong> is 20. I would like to be able to pass named parameters to the function. How could I accomplish this?</p>
  
  <p>Here's a little code sample :</p>
  
  <pre><code>
  
  def intercept(func):
      def intercepting_func(*args,**kargs):
          print "whatever"
          return func(*args,**kargs)
      return intercepting_func
  
  @intercept(a="g")
  def test(a,b):
      print "test with %s %s" %(a,b)
  
  test("g","d")
  </code></pre>
  
  <p><strong>This throws the following exception TypeError: intercept() got an unexpected keyword argument 'a'</strong></p>