mdot: use py3-compatible functools.reduce.