title: How do I add a new key-value pair in a smart way to a dict if the key is already contained in the dict?
body: <p>As the title says, I want to write a function that automatically detects,
  when adding a key value pair, if this key is already included in the dict.</p>
  <p>If this is the case, an ascending number should be added to the key and the slightly changed key value pair should be added to the dict.</p>
  <p>As seen in the following example, my current horrible approach is to query each case individually, how can I do that in a smart way for any number of keys with the same name.</p>
  <pre><code>            if &quot;begin time&quot; in day_dict.keys():
                  if &quot;begin time2&quot; in day_dict.keys():
                      if &quot;begin time3&quot; in day_dict.keys():
                          day_dict[&quot;begin time4&quot;] = value
                      else:
                          day_dict[&quot;begin time3&quot;] = value 
                  else:
                      day_dict[&quot;begin time2&quot;] = value
              else:
                  day_dict[&quot;begin time&quot;] = value
  </code></pre>