RF: use compatible import of reduce

reduce disappeared from the builtin namespace in Python 3.