def write(self, data):

        assert type(data) is StringType,"write() argument must be string"

        if not self.status:
            raise AssertionError("write() before start_response()")

        elif not self.headers_sent:
            # Before the first output, send the stored headers
            self.bytes_sent = len(data)    # make sure we know content-length
            self.send_headers()
        else:
            self.bytes_sent += len(data)

        # XXX check Content-Length and truncate if too many bytes written?
        self._write(data)
        self._flush()
'write()' callable as specified by PEP 333
dataset/ETHPy150Open CollabQ/CollabQ/vendor/wsgiref/handlers.py/BaseHandler.write