title: Check if a given key already exists in a dictionary
body: <p>I wanted to test if a key exists in a dictionary before updating the value for the key.
  I wrote the following code:</p>
  
  <pre><code>if 'key1' in dict.keys():
    print "blah"
  else:
    print "boo"
  </code></pre>
  
  <p>I think this is not the best way to accomplish this task. Is there a better way to test for a key in the dictionary?</p>