code: def _attr_sort_func(model, iter1, iter2, attribute):
      
      attr1 = getattr(model[iter1][0], attribute, None)
      attr2 = getattr(model[iter2][0], attribute, None)
      return cmp(attr1, attr2)
docs: Internal helper