def addCondition(self, *fns, **kwargs):
msg = kwargs.get("<STR_LIT:message>", "<STR_LIT>")<EOL>exc_type = ParseFatalException if kwargs.get("<STR_LIT>", False) else ParseException<EOL>for fn in fns:<EOL><INDENT>fn = _trim_arity(fn)<EOL>def pa(s,l,t):<EOL><INDENT>if not bool(fn(s,l,t)):<EOL><INDENT>raise exc_type(s,l,msg)<EOL><DEDENT><DEDENT>self.parseAction.append(pa)<EOL><DEDENT>self.callDuringTry = self.callDuringTry or kwargs.get("<STR_LIT>", False)<EOL>return self<EOL>
Add a boolean predicate function to expression's list of parse actions. See
        :class:`setParseAction` for function call signatures. Unlike ``setParseAction``,
        functions passed to ``addCondition`` need to return boolean success/fail of the condition.

        Optional keyword arguments:
        - message = define a custom message to be used in the raised exception
        - fatal   = if True, will raise ParseFatalException to stop parsing immediately; otherwise will raise ParseException

        Example::

            integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
            year_int = integer.copy()
            year_int.addCondition(lambda toks: toks[0] >= 2000, message="Only support years 2000 and later")
            date_str = year_int + '/' + integer + '/' + integer

            result = date_str.parseString("1999/12/31")  # -> Exception: Only support years 2000 and later (at char 0), (line:1, col:1)