def handle_write(self):
        """Send (a part of) the response on the socket
        Finish the request if the whole response has been sent
        self.response is a list of strings or file objects
        """
        # get next piece of data from self.response
        buff = ''
        while self.response and not buff:
            if isinstance(self.response[0],str):
                buff = self.response.pop(0)
            else:
                buff = self.response[0].read(self.blocksize)
                if not buff:
                    self.response.pop(0)
        if buff:
            try:
                self.client_socket.sendall(buff)
            except socket.error:
                self.close()
            if self.response:
                return
        # nothing left in self.response
        if self.close_when_done:
            self.close() # close socket
        else:
            # reset for next request
            self.writable = False
            self.incoming = ''
Send (a part of) the response on the socket
        Finish the request if the whole response has been sent
        self.response is a list of strings or file objects
        
recipes/Python/511453_generic_multi_protocol_asynchronous/recipe-511453.py