reduce was moved to functools in Python 3