title: Sorting 2 defaultdicts by one of the values
body: <p>I have 2 defaultdicts, in which I am trying to sort my results using the values from one of the defaultdict but I am having trouble doing that.</p>
  
  <p>My code is working, partially correct in the manner I am expecting it to be, however not when I tried to sort by the sizing, as you can see in <code>item_B_v</code>output below (those big numbers in the last column within the square brackets).
  In that row, I am expecting <code>ias</code> result to be place first then <code>yannix</code></p>
  
  <pre><code>| item_A_v(xxx) |    2 |    greggor [222122758 (1)], anise [8569153 (1)] |
  | item_B_v(xxx) |   21 |     yannix [2309188 (1)], ias [2903105467 (20)] |
  | item_C_v(xxx) |   11 |                         yannix [221837769 (11)] |
  </code></pre>
  
  <p>Example of the defaultdicts that I had:</p>
  
  <pre><code># Variable name - user_item_count
  # Each users' versions
  defaultdict(&lt;function &lt;lambda&gt; at 0x44f09b0&gt;,
      {'yannix': defaultdict(&lt;type 'int'&gt;, {'item_B_v': 1, 'item_C_v': 11}),
       'greggor': defaultdict(&lt;type 'int'&gt;, {'item_A_v': 1}),
       'anise': defaultdict(&lt;type 'int'&gt;, {'item_A_v': 1}),
       'ias': defaultdict(&lt;type 'int'&gt;, {'item_B_v': 20})})
  
  # Variable name - item_size_dict
  # Each items' sizes - version_size
  defaultdict(&lt;function &lt;lambda&gt; at 0x44f08c0&gt;,
      {'yannix': defaultdict(&lt;type 'int'&gt;, {'item_B_v': 2309188, 'item_C_v': 221837769}),
       'greggor': defaultdict(&lt;type 'int'&gt;, {'item_A_v': 222122758}),
       'anise': defaultdict(&lt;type 'int'&gt;, {'item_A_v': 8569153}),
       'ias': defaultdict(&lt;type 'int'&gt;, {'item_B_v': 2903105467})})
  </code></pre>
  
  <p>And this is the code that I have done that generates the above output:</p>
  
  <pre><code>user_name_dict = defaultdict(set)
  item_count = defaultdict(int)
  user_item_count = defaultdict(lambda: defaultdict(int))
  item_size_dict = defaultdict(lambda: defaultdict(int))
  
  """
  {'item_B_v032': ('ias', 37525303), 'item_C_v008': ('yannix', 14916429),
   'item_C_v009': ('yannix', 14789268), 'item_C_v005': ('yannix', 51182813),
   'item_C_v006': ('yannix', 17509593), 'item_C_v007': ('yannix', 21022937),
   'item_B_v025': ('ias', 187150302), 'item_B_v024': ('ias', 187150302),
   'item_B_v027': ('ias', 187150302), 'item_B_v026': ('ias', 187150302),
   'item_B_v030': ('ias', 187150302), 'item_B_v020': ('ias', 187150302),
   'item_B_v023': ('ias', 187150302), 'item_B_v022': ('ias', 187150302), 
   'item_B_v005': ('yannix', 2309188), 'item_B_v029': ('ias', 187150302), 
   'item_B_v028': ('ias', 187150302), 'item_A_v003': ('anise', 8569153), 
   'item_A_v006': ('greggor', 222122758), 'item_B_v037': ('ias', 23504129), 
   'item_C_v017': ('yannix', 18353866), 'item_C_v011': ('yannix', 11118693), 
   'item_C_v010': ('yannix', 11118703), 'item_C_v020': ('yannix', 18353866), 
   'item_C_v021': ('yannix', 11118693), 'item_C_v022': ('yannix', 11118703),
   'item_B_v014': ('ias', 208622214), 'item_B_v015': ('ias', 208855972), 
   'item_B_v016': ('ias', 187150302), 'item_B_v017': ('ias', 187150302), 
   'item_B_v011': ('ias', 5490970), 'item_B_v012': ('ias', 13747673), 
   'item_B_v013': ('ias', 122030327), 'item_B_v033': ('ias', 37525255)}
  """
  
  for item_name, item_user_tag in some_results.iteritems():
      strip_item = item_name[:-3]
      user_name_dict[strip_item].add(item_user_tag[0])
      item_count[strip_item] += 1
      user_item_count[item_user_tag[0]][strip_item] += 1
      item_size_dict[item_user_tag[0]][strip_item] += item_user_tag[1]
  
  
  for new_item_name, new_item_count in sorted(item_count.iteritems()):
      users = ', '.join('{0} [{1} ({2})]'.format(
                      user,
                      item_size_dict[user][new_item_name],
                      user_item_count[user][new_item_name]
                      )
                  for user in user_name_dict[new_item_name]
                  )
      print "| {0} | {1} | {2} |".format(new_item_name,
                                         new_item_count,
                                         users)
  </code></pre>
  
  <p>Seeing that both dicts are containing the same amount of items, is it possible for me to 'zip' it together or some sort and have it sorted using the values from one of the dict?</p>