def METHOD_NAME(self, o, c, a, b):
    if c:
        raise ArityMismatch(f"Condition cannot depend on form arguments ({_afmt(a)}).")
    if a and isinstance(o.ufl_operands[2], Zero):
        # Allow conditional(c, arg, 0)
        return a
    elif b and isinstance(o.ufl_operands[1], Zero):
        # Allow conditional(c, 0, arg)
        return b
    elif a == b:
        # Allow conditional(c, test, test)
        return a
    else:
        # Do not allow e.g. conditional(c, test, trial),
        # conditional(c, test, nonzeroconstant)
        raise ArityMismatch("Conditional subexpressions with non-matching form arguments "
                            f"{_afmt(a)} vs {_afmt(b)}.")