title: Finding the max value of list in dictionary
body: <p>I have a dict and behind each key is a list stored.
  Looks like this:</p>
  
  <pre><code>dict with values:  {
  u'New_York': [(u'New_York', u'NY', datetime.datetime(2014, 8, 13, 0, 0), 10), (u'New_York', u'NY', datetime.datetime(2014, 8, 13, 0, 0), 4), (u'New_York', u'NY', datetime.datetime(2014, 8, 13, 0, 0), 3)], 
  u'Jersy': [(u'Jersy', u'JY', datetime.datetime(2014, 8, 13, 0, 0), 6), (u'Jersy', u'JY', datetime.datetime(2014, 8, 13, 0, 0), 7)], 
  u'Alameda': [(u'Alameda', u'CA', datetime.datetime(2014, 8, 13, 0, 0), 1), (u'Alameda', u'CA', datetime.datetime(2014, 8, 13, 0, 0), 2), (u'Alameda', u'CA', datetime.datetime(2014, 8, 13, 0, 0), 3), (u'Alameda', u'CA', datetime.datetime(2014, 8, 13, 0, 0), 1)]
  }
  </code></pre>
  
  <p>What I want is to iterate through the dic lists and return the max in a certain position of the list for each KEY. The result should contain the KEY and the whole element of the list with the max value. Perfect would be to store the returned element in a dic as well.</p>
  
  <p>Example:
  Max Value here with the values at the attributes last position of the list.</p>
  
  <pre><code>somedic = {
  u'New_York': (u'New_York', u'NY', datetime.datetime(2014, 8, 13, 0, 0), 10)
  u'Jersy': (u'Jersy', u'JY', datetime.datetime(2014, 8, 13, 0, 0), 7)
  u'Alameda': (u'Alameda', u'CA', datetime.datetime(2014, 8, 13, 0, 0), 3)
  }
  </code></pre>
  
  <p>I tried a couple of thinks, by looking at these Freds:</p>
  
  <p><a href="https://stackoverflow.com/questions/268272/getting-key-with-maximum-value-in-dictionary">Getting key with maximum value in dictionary?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/14884376/max-min-value-of-dictionary-of-list">Max/Min value of Dictionary of List</a></p>
  
  <p><a href="https://stackoverflow.com/questions/11729670/python-miminum-value-in-dictionary-of-lists?lq=1">Python miminum value in dictionary of lists</a></p>
  
  <p><a href="https://stackoverflow.com/questions/11730552/python-miminum-length-max-value-in-dictionary-of-lists">Python miminum length/max value in dictionary of lists</a></p>
  
  <p>But I cannot get my head around it. It is simply above my abilities. I just started to learn python. I tried something like this:</p>
  
  <pre><code>import operator
  
  maxvalues = {}
  maxvalues = max(countylist.iteritems(), key=operator.itemgetter(1))[0]
  print "should be max values here: ", maxvalues
  #gave me New York
  </code></pre>
  
  <p>Is that possible?
  I am working on Python 2.7
  It would be awesome if the code snipped one posts as an answer could be explained, since I want to learn something!</p>
  
  <p>Btw I am not looking for a ready to use code. Some hints and code snippet work for me. I will work my way from there on through it. That's how I will learn the most.</p>