code: def _assert_expr_results_eq(expr_provider, skip_expr_assert=False):
      flag = h2o.is_expr_optimizations_enabled()
      try:
          # Get result of optimized expression
          h2o.enable_expr_optimizations(True)
          opt_expr = expr_provider()
          opt_result = H2OFrame._expr(opt_expr)
          # Get result of full expression
          h2o.enable_expr_optimizations(False)
          noopt_expr = expr_provider()
          noopt_result = H2OFrame._expr(noopt_expr)
          if not skip_expr_assert:
              assert (
                  opt_expr._debug_print() != noopt_expr._debug_print()
              ), "The optimization should simplify expression!"
          assert noopt_result.as_data_frame(
              use_pandas=False
          ) == opt_result.as_data_frame(
              use_pandas=False
          ), "Results with/without expression optimization should match!"
          return opt_expr, noopt_expr
      finally:
          h2o.enable_expr_optimizations(flag)
  
file_path: h2o-3/h2o-py/tests/testdir_misc/pyunit_expr_optimizations.py
imports: import h2o
  import sys
  from tests import pyunit_utils
  from h2o import H2OFrame
  from h2o.expr import ExprNode
label_desc: Use image node_id 1 for calling a global function with example usage: _assert_expr_results_eq(expr_provider, skip_expr_assert) and returns: opt_expr,  noopt_expr