re-wite the collection.counter methout to fit python 2.6 3