'Change the modes on a user or channel.
The C{limit}, C{user}, and C{mask} parameters are mutually exclusive.
@type chan: C{str}
@param chan: The name of the channel to operate on.
@type set: C{bool}
@param set: True to give the user or channel permissions and False to
remove them.
@type modes: C{str}
@param modes: The mode flags to set on the user or channel.
@type limit: C{int}
@param limit: In conjunction with the C{\'l\'} mode flag, limits the
number of users on the channel.
@type user: C{str}
@param user: The user to change the mode on.
@type mask: C{str}
@param mask: In conjunction with the C{\'b\'} mode flag, sets a mask of
users to be banned from the channel.'

def mode(self, chan, set, modes, limit=None, user=None, mask=None):

    if set:
        line = ('MODE    %s    +%s' % (chan, modes))
    else:
        line = ('MODE    %s    -%s' % (chan, modes))
    if (limit is not None):
        line = ('%s    %d' % (line, limit))
    elif (user is not None):
        line = ('%s    %s' % (line, user))
    elif (mask is not None):
        line = ('%s    %s' % (line, mask))
    self.sendLine(line)
