<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def privmsg(self, target, message, nowait=False):
 """send a privmsg to target"""

        if message:
            messages = utils.split_message(message, self.config.max_length)
            if isinstance(target, DCCChat):
                for message in messages:
                    target.send_line(message)
            elif target:
                f = None
                for message in messages:
                    f = self.send_line('PRIVMSG %s :%s' % (target, message),
                                       nowait=nowait)
                return f