Backport of the Python 2.7's collections module to older versions