def finish(self):
        """When all data has been received, send what remains
        in the buffer"""
        data = self.buffer.getvalue()
        # send data
        while len(data):
            while not self.writable():
                pass
            sent = self.sock.send(data)
            data = data[sent:]
When all data has been received, send what remains
        in the buffer
recipes/Python/259148_Simple_HTTP_server_based/recipe-259148.py