'Write data to the transport (if not responding to a HEAD request).
@param data: A string to write to the response.'

def write(self, data):

    if (not self.startedWriting):
        needsCT = (self.code not in (http.NOT_MODIFIED, http.NO_CONTENT))
        contentType = self.responseHeaders.getRawHeaders('content-type')
        contentLength = self.responseHeaders.getRawHeaders('content-length')
        contentLengthZero = (contentLength and (contentLength[0] == '0'))
        if (needsCT and (contentType is None) and (self.defaultContentType is not None) and (not contentLengthZero)):
            self.responseHeaders.setRawHeaders('content-type', [self.defaultContentType])
    if (not self._inFakeHead):
        if self._encoder:
            data = self._encoder.encode(data)
        http.Request.write(self, data)
