def METHOD_NAME(self, param, ruleval, argval):
    """
    Test that a single rule value matches the given value for a given
    parameter.
    """
    if ruleval == argval:
        return True
    if param == 'domain':
        # Domains are special:
        # * Usernames are given exactly
        # * Group names are prefixed by @ and given exactly, argval must
        #   also start with @ and is therefore an exact match as above.
        # * Wildcards match everything:
        if ruleval == '*':
            return True
        # UID ranges - must be an integer argument:
        if (not ruleval.startswith('@')) and ':' in ruleval and \
         isinstance(argval, int):
            low, high = ruleval.split(':')
            # :max matches exactly
            if not low and int(high) == argval:
                return True
            # min: matches everything not less than min
            if not high and int(low) <= argval:
                return True
            # else match in range
            if low and high and (int(low) <= argval <= int(high)):
                return True
        # GID ranges - argval must be a string starting with '@' and
        # all numbers.
        if ruleval.startswith('@') and ':' in ruleval[1:] and \
         isinstance(argval, str) and \
         argval.startswith('@') and argval[1:].isdigit():
            low, high = ruleval[1:].split(':')
            gid = int(argval[1:])
            # :max matches exactly
            if not low and int(high) == gid:
                return True
            # min: matches everything not less than min
            if not high and int(low) <= gid:
                return True
            # else match in range
            if low and high and (int(low) <= gid <= int(high)):
                return True
        # * We ignore % maxlogin limits here.
    # From the man page: "Note, if you specify a type of '-' but neglect
    # to supply the item and value fields then the module will never
    # enforce any limits on the specified user/group etc."
    if param == 'type' and ruleval == '-':
        return True
    return False