Python itertools and surrounding methods written i templated C++11