import reduce from functools for python3