docs: def handle_privmsg(self, params):
          """
          Handle sending a private message to a user or channel.
          """
          target, sep, msg = params.partition(' ')
          if not msg:
              raise IRCError.from_name(
                  'needmoreparams',
                  'PRIVMSG :Not enough parameters')
  
          message = ':%s PRIVMSG %s %s' % (self.client_ident(), target, msg)
          if target.startswith('#') or target.startswith('$'):
              # Message to channel. Check if the channel exists.
              channel = self.server.channels.get(target)
              if not channel:
                  raise IRCError.from_name('nosuchnick', 'PRIVMSG :%s' % target)
  
              if channel.name not in self.channels:
                  # The user isn't in the channel.
                  raise IRCError.from_name(
                      'cannotsendtochan',
                      '%s :Cannot send to channel' % channel.name)
  
              self._send_to_others(message, channel)
          else:
              # Message to user
              client = self.server.clients.get(target, None)
              if not client:
                  raise IRCError.from_name('nosuchnick', 'PRIVMSG :%s' % target)
  
              client.send_queue.append(message)