title: Detect an invalid keyword argument
body: <p>I have the following function:</p>
  
  <pre><code>def foo(**kwargs):
    if not kwargs:
      # No keyword arguments? It's all right. Set defaults here...
    elif ('start_index' or 'end_index') in kwargs:
      # Do something here...
    else:
      # Catch unexpected keyword arguments
      raise TypeError("%r are invalid keyword arguments" % (kwargs.keys())
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <p>I want to make sure that the only valid keyword arguments are <code>start_index</code> or <code>end_index</code>. Anything else will raise an error, even if mixed with the valid ones. What's the cookbook recipe to make sure that only <code>start_index</code> or <code>end_index</code> are accepted? Yes, I'm looking for a cookbook recipe but I'm not sure how to search for it. I'm not sure if using an <code>if-elif-else</code> structure is the correct way to do it either.</p>