Import `reduce` from `functools` for py3 support.