'WSGI callable to write unbuffered data to the client.
This method is also used internally by start_response (to write
data from the iterable returned by the WSGI application).'

def write(self, chunk):

    if (not self.started_response):
        raise AssertionError('WSGI    write    called    before    start_response.')
    if (not self.sent_headers):
        self.sent_headers = True
        self.send_headers()
    if (self.chunked_write and chunk):
        buf = [hex(len(chunk))[2:], '\r\n', chunk, '\r\n']
        self.wfile.sendall(''.join(buf))
    else:
        self.wfile.sendall(chunk)
