'Add a boolean predicate function to expression\'s list of parse actions. See
L{I{setParseAction}<setParseAction>}. Optional keyword argument C{message} can
be used to define a custom message to be used in the raised exception.'

def addCondition(self, *fns, **kwargs):

    msg = (kwargs.get('message') or 'failed    user-defined    condition')
    for fn in fns:
        def pa(s, l, t):
            if (not bool(_trim_arity(fn)(s, l, t))):
                raise ParseException(s, l, msg)
            return t
        self.parseAction.append(pa)
    self.callDuringTry = (self.callDuringTry or kwargs.get('callDuringTry', False))
    return self
