title: Pythonic way to overwrite a default argument with **kwargs?
body: <p>With a function <code>f</code> calling another well-known function in Python (e.g. a <code>matplotlib</code> function), what is the most pythonic/efficient/elegant way to define some default values while still giving the possibility to the user of <code>f</code> to fully customize the called function (typically with <code>**kwargs</code>), including to overwrite the default keyword arguments defined in <code>f</code>?</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  
  
  v = np.linspace(-10.,10.,100)
  x,y = np.meshgrid(v, v)
  z = -np.hypot(x, y)
  
  def f(ax, n=12, **kwargs):
      ax.contourf(x, y, z, n, cmap=plt.cm.autumn, **kwargs)
  
  fig, ((ax0, ax1), (ax2, ax3)) = plt.subplots(2, 2)
  f(ax0) # OK
  f(ax1, n=100) # OK
  f(ax2, n=100, **{'vmax': -2, 'alpha': 0.2}) # OK
  # f(ax3, n=100, **{'cmap': plt.cm.cool}) # ERROR
  
  plt.show()
  </code></pre>
  
  <p>Here, the last call to <code>f</code> throws:</p>
  
  <blockquote>
    <p>TypeError: contourf() got multiple values for keyword argument 'cmap'</p>
  </blockquote>