title: python: group elements of a tuple having the same first element
body: <p>i have a tuple like this</p>
  
  <pre><code>[
  (379146591, 'it', 55, 1, 1, 'NON ENTRARE', 'NonEntrate', 55, 1), 
  (4746004, 'it', 28, 2, 2, 'NON ENTRARE', 'NonEntrate', 26, 2), 
  (4746004, 'it', 28, 2, 2, 'TheBestTroll Group', 'TheBestTrollGroup', 2, 3)
  ]
  </code></pre>
  
  <p>i would like to get instead this:</p>
  
  <pre><code>[
  (379146591, (('it', 55, 1, 1, 'NON ENTRARE', 'NonEntrate', 55, 1)), 
  (4746004, (('it', 28, 2, 2, 'NON ENTRARE', 'NonEntrate', 26, 2), ('it', 28, 2, 2, 'TheBestTroll Group', 'TheBestTrollGroup', 2, 3)))
  ]
  </code></pre>
  
  <p>so the for any element, anything that is not the first element is inside a sub-tuple of it, and if the following element has the same element as first element, it will be set as another sub-tuple of the previous one.</p>
  
  <p>so i can do:</p>
  
  <pre><code>for i in data:
      # getting the first element of the list
      for sub_i in i[1]:
          # i access all the tuples inside
  </code></pre>
  
  <p>are there some functions to do this?</p>