Python 3 support for reduce.