<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def batch_stream(buff, stream, size=DEFAULT_BATCH_SIZE):
 """Writes a batch of `size` lines to `buff`. Returns boolean of whether the stream has been exhausted. """

    buff.truncate(0)
    for _ in xrange(size):
        if hasattr(stream, 'readline'):
            line = stream.readline()
        else:
            try:
                line = next(stream)
            except StopIteration:
                line = ''

        # No more lines, return the tmp
        if line == '':
            buff.seek(0)
            return True
        buff.write(line)
    buff.seek(0)
    return False