title: Pythonic way for checking if value exists in dictionary of dictionaries and taking corresponding actions
body: <p>I have created a dictionary of dictionaries as:</p>
  
  <pre><code>from collections import defaultdict
  d = defaultdict(dict)
  </code></pre>
  
  <p>Now I have some strings (let us call this set <code>A</code>) which have a dictionary of strings (as key) and integers (as value) corresponding to it. So the above data structure models this data completely. </p>
  
  <p>Now I want to check if a string corresponding to a key in <code>A</code> exists in the dictionary. If it does not exist I want to add it and make its counter <code>1</code>. If it already exists, I want to increment the counter.</p>
  
  <p>Is there is pythonic way to do this?</p>