def accumulate(iterable, func, *, initial=None):
    """https://docs.python.org/3/library/itertools.html#itertools.accumulate

    Stolen but not used since I ddidn have ython 3.8 handy and wanted to use the initial
    keyword argument

    """
    it = iter(iterable)
    total = initial
    if initial is None:
        try:
            total = next(it)
        except StopIteration:
            return
    yield total
    for element in it:
        total = func(total, element)
        yield total
