code: def _check_reduce_op(reduce_op, mode="reduce_mean") -> bool:
      """
      Check whether or not the reduction op satisfy following conditions:
      - Mode is expected.
      - Does not change rank (keep_dims is True).
      - Axes are known at compile time.
  
      :param reduce_op: reduce op to check on
      :param mode: reduce mode
      """
      if reduce_op is None:
          return False
      if reduce_op.op_type != mode:
          return False
      if reduce_op.keep_dims.val is False:
          return False
      if reduce_op.axes is None or reduce_op.axes.val is None:
          return False
      return True
  
file_path: coremltools/coremltools/converters/mil/experimental/passes/generic_layernorm_instancenorm_pattern_fusion.py
imports: import os
  import numpy
  from coremltools.converters.mil import Builder
  from coremltools.converters.mil.experimental.passes.generic_pass_infrastructure import register_generic_pass
  from coremltools.converters.mil.mil import get_new_symbol
label_desc: Use image node_id 1 for calling a global function with example usage: _check_reduce_op(reduce_op, mode) and returns: True, False, False, False, False