'Write string s to the stream if a whole new block
is ready to be written.'

def __write(self, s):

    self.buf += s
    while (len(self.buf) > self.bufsize):
        self.fileobj.write(self.buf[:self.bufsize])
        self.buf = self.buf[self.bufsize:]
