def to_buffer(f):
    """
    Decorator converting all strings and iterators/iterables into Buffers.
    """
    @functools.wraps(f)
    def wrap(*args, **kwargs):
        iterator = kwargs.get('iterator', args[0])
        if not isinstance(iterator, Buffer):
            iterator = Buffer(iterator)
        return f(iterator, *args[1:], **kwargs)
    return wrap
def to_buffer ( f ) : @ functools . wraps ( f ) def wrap ( * args , ** kwargs ) : iterator = kwargs . get ( 'iterator' , args [ 0 ] ) if not isinstance ( iterator , Buffer ) : iterator = Buffer ( iterator ) return f ( iterator , * args [ 1 : ] , ** kwargs ) return wrap
Decorator converting all strings and iterators/iterables into Buffers.