title: Python convert args to kwargs
body: <p>I am writing a decorator that needs to call other functions prior to call of the function that it is decorating.  The decorated function may have positional arguments, but the functions the decorator will call can only accept keyword arguments.  Does anyone have a handy way of converting positional arguments into keyword arguments?</p>
  
  <p>I know that I can get a list of the variable names of the decorated function:</p>
  
  <pre><code>&gt;&gt;&gt; def a(one, two=2):
  ...    pass
  
  &gt;&gt;&gt; a.func_code.co_varnames
  ('one', 'two')
  </code></pre>
  
  <p>But I can't figure out how to tell what was passed in positionally and what was as keyword.</p>
  
  <p>My decorator looks like this:</p>
  
  <pre><code>class mydec(object):
      def __init__(self, f, *args, **kwargs):
          self.f = f
  
      def __call__(self, *args, **kwargs):
          hozer(**kwargs)
          self.f(*args, **kwargs)
  </code></pre>
  
  <p>Is there a way other than just comparing kwargs and co_varnames, adding to kwargs anything not in there, and hoping for the best?</p>