def _rank_dists(ranks1, ranks2):
 ranks1 = dict(ranks1)
 ranks2 = dict(ranks2)
 for k in ranks1:
  try:
   (yield (k, (ranks1[k] - ranks2[k])))
  except KeyError:
   pass

def _rank_dists ( ranks1 , ranks2 ) : ranks1 = dict ( ranks1 ) ranks2 = dict ( ranks2 ) for k in ranks1 : try : ( yield ( k , ( ranks1 [ k ] - ranks2 [ k ] ) ) ) except KeyError : pass
finds the difference between the values in ranks1 and ranks2 for keys present in both dicts .