title: How to ignore unexpected keyword argument(s) passed to functions in Python
body: <p>My question is related to this <a href="https://stackoverflow.com/questions/26515595/how-does-one-ignore-unexpected-keyword-arguments-passed-to-a-function">one</a>, however the <code>**kwargs</code> solution there isn't working for me. </p>
  
  <p>Let's say I have some functions as shown below. <code>func_a</code> prints the values of <code>arg1</code> and <code>arg2</code>. <code>func_b</code> prints the values of <code>arg1</code> and <code>arg3</code>. So <code>arg1</code> is common to both functions. I now have a function, <code>func</code>, that calls both <code>func_a</code> and <code>func_b</code>. In the arguments to <code>func</code> I want to be able to pass <code>arg1</code>, with <code>arg2</code> and <code>arg3</code> as optional arguments, hence why I set <code>arg2</code> and <code>arg3</code> to <code>None</code> by default. However, when I try to call <code>func(arg1='how', arg2='are')</code> I get an <code>unexpected keyword argument</code> error. How can I fix this? </p>
  
  <pre><code>def func_a(arg1, arg2=None):
      print(arg1)
      if arg2 is not None:
          print(arg2)
  
  def func_b(arg1, arg3=None):
      print(arg1)
      if arg3 is not None:
          print(arg3)
  
  def func(arg1, **kwargs):
      func_a(arg1, **kwargs)
      func_b(arg1, **kwargs)
  
  # Try to call func
  func(arg1='how', arg2='are')
  how
  are
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-11-372fbc7b1e90&gt; in &lt;module&gt;
  ----&gt; 1 func(arg1='how', arg2='are')
  
  &lt;ipython-input-8-5edc2a4c5bfd&gt; in func(arg1, **kwargs)
       11 def func(arg1, **kwargs):
       12     func_a(arg1, **kwargs)
  ---&gt; 13     func_b(arg1, **kwargs)
  
  TypeError: func_b() got an unexpected keyword argument 'arg2'
  </code></pre>