code: def transmit(self, channel, msg):
  		r
  		is_action, msg = self.action_pattern.match(msg).groups()
  		func = self._conn.action if is_action else self._conn.privmsg
  		try:
  			func(channel, msg)
  			return msg
  		except irc.client.MessageTooLong:
  			# some msgs will fail because they're too long
  			log.warning("Long message could not be transmitted: %s", msg)
  		except irc.client.InvalidCharacters:
  			tmpl = (
  				"Message contains carriage returns, "
  				"which aren't allowed in IRC messages: %r"
  			)
  			log.warning(tmpl, msg)
docs: r"""
  		Transmit the message (or action) and return what was transmitted.
  
  		>>> ap = LoggingCommandBot.action_pattern
  		>>> ap.match('foo').groups()
  		(None, 'foo')
  		>>> ap.match('foo\nbar\n').group(2)
  		'foo\nbar\n'
  		>>> is_action, msg = ap.match('/me  is feeling fine today').groups()
  		>>> bool(is_action)
  		True
  		>>> msg
  		'is feeling fine today'