def _extract_model_data(model):
 data = []
 for i in range(0, model.rowCount()):
  cat_idx = model.index(i, 0)
  row = []
  for j in range(0, model.rowCount(cat_idx)):
   row.append((model.data(cat_idx.child(j, 0)), model.data(cat_idx.child(j, 1)), model.data(cat_idx.child(j, 2))))
  data.append(row)
 return data

def _extract_model_data ( model ) : data = [ ] for i in range ( 0 , model . rowCount ( ) ) : cat_idx = model . index ( i , 0 ) row = [ ] for j in range ( 0 , model . rowCount ( cat_idx ) ) : row . append ( ( model . data ( cat_idx . child ( j , 0 ) ) , model . data ( cat_idx . child ( j , 1 ) ) , model . data ( cat_idx . child ( j , 2 ) ) ) ) data . append ( row ) return data
express a models data as a list for easier comparison .