Fix reduce usage under Python3.