These functions have been copied from the recipes in the Python documentation for itertools. http://docs.python.org/library/itertools.html#recipes
The inspiration for itertools.py is from this post by Alex Martelli on stackoverflow. http://stackoverflow.com/questions/1639772
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.