PY3 reduce to functools.reduce