Adding `accumulate' fn to return accumulated sums

Accumulate is already available from itertools for Python >=3.3, for the
rest of us this provides the accumulate function