def msg(self, user, message, length=MAX_COMMAND_LENGTH):
        """
        Send a message to a user or channel.

        The message will be split into multiple commands to the server if:
         - The message contains any newline characters
         - Any span between newline characters is longer than the given
           line-length.

        @param user: The username or channel name to which to direct the
            message.
        @type user: C{str}

        @param message: The text to send.
        @type message: C{str}

        @param length: The maximum number of octets to send in a single
            command, including the IRC protocol framing. If not supplied,
            defaults to L{MAX_COMMAND_LENGTH}.
        @type length: C{int}
        """
        fmt = "PRIVMSG %s :%%s" % (user,)

        # NOTE: minimumLength really equals len(fmt) - 2 (for '%s') + 2
        # (for the line-terminating CRLF)
        minimumLength = len(fmt)
        if length <= minimumLength:
            raise ValueError("Maximum length must exceed %d for message "
                             "to %s" % (minimumLength, user))
        for line in split(message, length - minimumLength):
            self.sendLine(fmt % (line,))
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/words/protocols/irc.py/IRCClient.msg/original