title: aggregate dictionary items into summary results
body: <p>I have a dictionary like </p>
  
  <pre><code>    mydict={
          (a,1):0,
          (a,2):0,
          (a,3):0,
          (a,4):1,
          (a,5):2,
          (a,6):2,
          (a,7)=0,
          (a,8)=0,           
  }
  </code></pre>
  
  <p>I want to summarize it in to </p>
  
  <pre><code>mysummarydict={
      (a,1,3):0,
      (a,4,4):1,
      (a,5,6):2,
      (a,7,8):0
      }
  </code></pre>
  
  <p>These values are from a dataset about intervals that do not overlap but that can have gaps. The first dictionary now has one entry for each single point and I would like to get a second dictionary that has a summary of those adjacent points that share a common value. Can you guide me to the best solution for this in python 2.6?
  Thanks</p>