Start a Deferred whose callBack arg is a deque of the accumulation
    of the values yielded from a_generator.

    :param a_generator: An iterator which yields some not None values.
    :return: A Deferred to which the next callback will be called with
     the yielded contents of the generator function.

def accumulate(a_generator, cooperator=None):
    """
    Start a Deferred whose callBack arg is a deque of the accumulation
    of the values yielded from a_generator.

    :param a_generator: An iterator which yields some not None values.
    :return: A Deferred to which the next callback will be called with
     the yielded contents of the generator function.
    """
    if cooperator:
        own_cooperate = cooperator.cooperate
    else:
        own_cooperate = cooperate

    spigot = ValueBucket()
    items = stream_tap((spigot,), a_generator)
    d = own_cooperate(items).whenDone()
    d.addCallback(accumulation_handler, spigot)
    return d