'Write a string to the file.
There is no return value.'

def write(self, s):

    _complain_ifclosed(self.closed)
    if (not s):
        return
    if (not isinstance(s, basestring)):
        s = str(s)
    spos = self.pos
    slen = self.len
    if (spos == slen):
        self.buflist.append(s)
        self.len = self.pos = (spos + len(s))
        return
    if (spos > slen):
        self.buflist.append(('\x00' * (spos - slen)))
        slen = spos
    newpos = (spos + len(s))
    if (spos < slen):
        if self.buflist:
            self.buf += ''.join(self.buflist)
        self.buflist = [self.buf[:spos], s, self.buf[newpos:]]
        self.buf = ''
        if (newpos > slen):
            slen = newpos
    else:
        self.buflist.append(s)
        slen = newpos
    self.len = slen
    self.pos = newpos
