def reduced(stream_red):
    '''
    reduced() is complementary to the greduce generator. 
    Use this function to keep the current value of the reduced stream. This
    is analog to reduce(lst) where reduce() is Pythons builtin reduce and lst
    is a list.    
    '''
    res = stream_red.next()
    if res is None:
        res = stream_red.throw(YieldResult)
        stream_red.next()
        return res
    for item in stream_red:
        if item is None:
            break
        else:
            res = item
    return res

    reduced() is complementary to the greduce generator. 
    Use this function to keep the current value of the reduced stream. This
    is analog to reduce(lst) where reduce() is Pythons builtin reduce and lst
    is a list.    
    
recipes/Python/498264_reduce_as_a_generator/recipe-498264.py