See https://github.com/pytoolz/itertoolz/commit/03b2b7e6340fbeb3207c54eb023a8055c3ac381e