Slap somebody.

    Syntax: {command} <nick> [for <reason>]

def cmd(send, msg, args):
    """Slap somebody.

    Syntax: {command} <nick> [for <reason>]

    """
    implements = ['the golden gate bridge', 'a large trout', 'a clue-by-four', 'a fresh haddock', 'moon', 'an Itanium', 'fwilson', 'a wombat']
    methods = ['around a bit', 'upside the head']
    if not msg:
        channel = args['target'] if args['target'] != 'private' else args['config']['core']['channel']
        with args['handler'].data_lock:
            users = list(args['handler'].channels[channel].users())
        slap = 'slaps %s %s with %s'
        send(slap % (choice(users), choice(methods), choice(implements)), 'action')
    else:
        reason = ''
        method = choice(methods)
        implement = ''
        msg = msg.split()
        slapee = msg[0]
        # Basic and stupid NLP!
        i = 1
        args = False
        while i < len(msg):
            if msg[i] == 'for':
                args = True
                if reason:
                    send("Invalid Syntax: You can only have one for clause!")
                    return
                i += 1
                while i < len(msg):
                    if msg[i] == 'with':
                        break
                    reason += " "
                    reason += msg[i]
                    i += 1
                reason = reason.strip()
            elif msg[i] == 'with':
                args = True
                if implement:
                    send("Invalid Synatx: You can only have one with clause!")
                    return
                i += 1
                while i < len(msg):
                    if msg[i] == 'for':
                        break
                    implement += msg[i]
                    implement += ' '
                    i += 1
                implement = implement.strip()
            elif not args:
                slapee += ' ' + msg[i]
            i += 1

        if not implement:
            implement = choice(implements)
        if reason:
            slap = 'slaps %s %s with %s for %s' % (slapee, method, implement, reason)
        else:
            slap = 'slaps %s %s with %s' % (slapee, method, implement)
        send(slap, 'action')