'write session data to the session output or stdout'

def write(self, obj, **kw):

    if self.sessionwriter:
        self.sessionwriter.write(obj, **kw)
    elif self.fh:
        self.fh.write(str(obj))
        if self.nobuffer:
            self.fh.flush()
