'\'write()\' callable as specified by PEP 3333'

def write(self, data):

    assert isinstance(data, bytes), 'write()    argument    must    be    bytestring'
    if (not self.status):
        raise AssertionError('write()    before    start_response()')
    elif (not self.headers_sent):
        self.bytes_sent = len(data)
        self.send_headers()
    else:
        self.bytes_sent += len(data)
    data = BytesIO(data)
    for chunk in iter((lambda : data.read(MAX_SOCKET_CHUNK_SIZE)), ''):
        self._write(chunk)
        self._flush()
