def send(self, data):
        """
        Tries to send data to the client.

        :param data: Data to be sent
        :return: True if the data was sent, False on error
        """
        if data is not None:
            data = data.encode("UTF-8")

        try:
            self.wfile.write(data)
            self.wfile.flush()
            return True

        except IOError:
            # An error occurred, mask it
            # -> This allows to handle the command even if the client has been
            # disconnect (i.e. "echo stop 0 | nc localhost 9000")
            return False
def send ( self , data ) : if data is not None : data = data . encode ( "UTF-8" ) try : self . wfile . write ( data ) self . wfile . flush ( ) return True except IOError : return False
Tries to send data to the client.

        :param data: Data to be sent
        :return: True if the data was sent, False on error