title: Best way to handle a keyerror in a dict
body: <p>I would like to know the best way to handle a keyerror, when I try to get a value from a dict. </p>
  
  <p>I need this because my dict holds the counts of some events. And whenever an event occurs I take the count from the dict and increment it and put it back.</p>
  
  <p>I found some solutions online, but they were for some other languages. Any help is appreciated.</p>
  
  <p>I am handling the keyerror exception now. Would like to know the best approach to handle a keyerror in a dictionary.</p>
  
  <p>Note: This is not about counting items in a list but about handling exception when retrieving a value(that does not exist) from a dict.</p>