def METHOD_NAME(a, b, *, oper):
    try:
        return oper(a, b)
    except RuntimeError as e:
        if "not call `__bool__` / `__nonzero__` on `Formula`" in str(e):
            if isinstance(a, _sym_cls_list):
                return oper(a, _sym.Expression(b))
            elif isinstance(b, _sym_cls_list):
                return oper(_sym.Expression(a), b)
        raise
    except DeprecationWarning as e:
        # N.B. This is only appears to be triggered for symbolic types.
        if _is_elementwise_comparison_error(e):
            if isinstance(a, np.generic):
                a = float(a)
            elif isinstance(b, np.generic):
                b = float(b)
            else:
                raise RuntimeError("Unexpected condition")
            return oper(a, b)
        raise