code: def _wrap_module_functions(
      module,
      is_numpy_module,
      target_dtype,
      get_aliases,
      get_cond_aliases,
      get_fun_to_wrap,
      target_precision_ops=None,
      conditional_fp32_ops=None,
      fp32_ops=None,
  ):
      nd_mod = ndarray.numpy._internal if is_numpy_module else ndarray
      sy_mod = symbol.numpy._internal if is_numpy_module else symbol
  
      def _ndarray_wrapper(
          f, target_dtype, fp32_param=None, cond_arg=None
      ):
          def _new_fun(*args, **kwargs):
              if cond_arg is not None:
                  if (
                      cond_arg[0] not in kwargs
                      or kwargs[cond_arg[0]] not in cond_arg[1]
                  ):
                      return f(*args, **kwargs)
              if fp32_param:
                  new_args = []
                  for i, x in enumerate(args):
                      if fp32_param[i]:
                          new_args.append(x)
                      else:
                          new_args.append(
                              _cast_symbol_NDArray(
                                  x, target_dtype, is_numpy_module
                              )
                          )
              else:
                  new_args = list(
                      map(
                          lambda x: _cast_symbol_NDArray(
                              x, target_dtype, is_numpy_module
                          ),
                          args,
                      )
                  )
              args = tuple(new_args)
              if fp32_param:
                  new_kwargs = {}
                  for k, v in kwargs.items():
                      if k in fp32_param:
                          new_kwargs[k] = v
                      else:
                          new_kwargs[k] = _cast_symbol_NDArray(
                              v, target_dtype, is_numpy_module
                          )
                      kwargs = new_kwargs
              else:
                  kwargs = {
                      k: _cast_symbol_NDArray(
                          v, target_dtype, is_numpy_module
                      )
                      for k, v in kwargs.items()
                  }
              return f(*args, **kwargs)
  
          _new_fun.__name__ = f.__name__
          _new_fun.__module__ = f.__module__
          _new_fun.__doc__ = f.__doc__
          return _new_fun
  
      def _symbol_wrapper(
          f, target_dtype, fp32_param=None, cond_arg=None
      ):
          def _new_fun(*args, **kwargs):
              if cond_arg is not None:
                  if (
                      cond_arg[0] not in kwargs
                      or kwargs[cond_arg[0]] not in cond_arg[1]
                  ):
                      return f(*args, **kwargs)
              sym = f(*args, **kwargs)
              inputs = sym.get_children()
              aux = sym.list_auxiliary_states()
              if fp32_param:
                  new_inputs = []
                  for i, x in enumerate(inputs):
                      if (x.name in aux) or fp32_param[i]:
                          new_inputs.append(x)
                      else:
                          new_inputs.append(
                              _cast_symbol_NDArray(
                                  x, target_dtype, is_numpy_module
                              )
                          )
                  inputs = new_inputs
              else:
                  inputs = list(
                      map(
                          lambda x: _cast_symbol_NDArray(
                              x, target_dtype, is_numpy_module
                          )
                          if x.name not in aux
                          else x,
                          inputs,
                      )
                  )
              atomic_sym = sym._gen_atomic_symbol()
              wrapped_sym = atomic_sym(*inputs)
              wrapped_sym._set_attr(name=sym.name)
              return wrapped_sym
  
          _new_fun.__name__ = f.__name__
          _new_fun.__module__ = f.__module__
          _new_fun.__doc__ = f.__doc__
          return _new_fun
  
      def _symbol_widest_wrapper(f):
          def _new_fun(*args, **kwargs):
              symbols = []
              is_symbol = False
              args = list(args)
              for i, arg in enumerate(args):
                  if isinstance(arg, (Symbol, NDArray)):
                      symbols.append((args, i, arg))
                      is_symbol = is_symbol or isinstance(arg, Symbol)
              for k, arg in kwargs.items():
                  if isinstance(arg, (Symbol, NDArray)):
                      symbols.append((kwargs, k, arg))
                      is_symbol = is_symbol or isinstance(arg, Symbol)
              if not is_symbol:
                  # NDArray case
                  widest_type = target_dtype
                  for _, _, arg in symbols:
                      if isinstance(arg, NDArray):
                          if arg.dtype == np.float32:
                              widest_type = np.float32
                  for arr, index, arg in symbols:
                      if (
                          arg.dtype != widest_type
                          and arg.dtype == target_dtype
                      ):
                          arr[index] = nd_mod.amp_cast(
                              arg, dtype=widest_type
                          )
              else:
                  # Symbol case
                  sym_to_check = list(map(lambda x: x[2], symbols))
                  casted_syms = sy_mod.amp_multicast(
                      *sym_to_check, num_outputs=len(sym_to_check)
                  )
                  symbols = list(
                      map(
                          lambda x_y: (x_y[0][0], x_y[0][1], x_y[1]),
                          zip(symbols, casted_syms),
                      )
                  )
                  for arr, index, arg in symbols:
                      arr[index] = arg
  
              return f(*args, **kwargs)
  
          _new_fun.__name__ = f.__name__
          _new_fun.__module__ = f.__module__
          _new_fun.__doc__ = f.__doc__
          return _new_fun
  
      _wrapper = (
          _symbol_wrapper
          if module in (symbol, Symbol, symbol_contrib)
          else _ndarray_wrapper
      )
  
      fp32_param_list = list_lp16_use_fp32_params(target_dtype)
      wrap_list = (
          target_precision_ops
          if target_precision_ops is not None
          else list_lp16_ops(target_dtype)
      )
      for fun_name in get_aliases(wrap_list):
          fun_name, modules = get_fun_to_wrap(fun_name, module)
          for cur_module in modules:
              f_to_wrap = getattr(cur_module, fun_name)
              fp32_param = (
                  fp32_param_list[fun_name]
                  if (fp32_param_list and fun_name in fp32_param_list)
                  else None
              )
              setattr(
                  cur_module,
                  fun_name,
                  _wrapper(
                      f_to_wrap, target_dtype, fp32_param=fp32_param
                  ),
              )
              if not is_numpy_module and cur_module == module:
                  setattr(
                      module.op,
                      fun_name,
                      _wrapper(
                          f_to_wrap, target_dtype, fp32_param=fp32_param
                      ),
                  )
  
      wrap_list = (
          fp32_ops
          if fp32_ops is not None
          else list_fp32_ops(target_dtype)
      )
      for fun_name in get_aliases(wrap_list):
          fun_name, modules = get_fun_to_wrap(fun_name, module)
          for cur_module in modules:
              f_to_wrap = getattr(cur_module, fun_name)
              setattr(
                  cur_module, fun_name, _wrapper(f_to_wrap, np.float32)
              )
              if not is_numpy_module and cur_module == module:
                  setattr(
                      module.op,
                      fun_name,
                      _wrapper(f_to_wrap, np.float32),
                  )
  
      wrap_list = (
          conditional_fp32_ops
          if conditional_fp32_ops is not None
          else list_conditional_fp32_ops(target_dtype)
      )
      for fun_name, arg, arg_values in get_cond_aliases(wrap_list):
          fun_name, modules = get_fun_to_wrap(fun_name, module)
          for cur_module in modules:
              f_to_wrap = getattr(cur_module, fun_name)
              setattr(
                  cur_module,
                  fun_name,
                  _wrapper(
                      f_to_wrap, np.float32, cond_arg=(arg, arg_values)
                  ),
              )
              if not is_numpy_module and cur_module == module:
                  setattr(
                      module.op,
                      fun_name,
                      _wrapper(
                          f_to_wrap,
                          np.float32,
                          cond_arg=(arg, arg_values),
                      ),
                  )
  
      for fun_name in get_aliases(list_widest_type_cast(target_dtype)):
          fun_name, modules = get_fun_to_wrap(fun_name, module)
          for cur_module in modules:
              f_to_wrap = getattr(cur_module, fun_name)
              setattr(
                  cur_module,
                  fun_name,
                  _symbol_widest_wrapper(f_to_wrap),
              )
              if not is_numpy_module and cur_module == module:
                  setattr(
                      module.op,
                      fun_name,
                      _symbol_widest_wrapper(f_to_wrap),
                  )
  
imports: from array import array
  import ctypes
  import inspect
  import logging
  import contextlib
  import sys
  import numpy
  from mxnet import numpy
  from ..None import symbol
  from ..device import gpu
  from ..symbol import Symbol
  from ..symbol import contrib
  from ..None import ndarray
  from ..ndarray import NDArray, dtype_np_to_mx, get_dtype_type, get_dtype_name, bfloat16
  from .None import lists
  from ..gluon import Block, HybridBlock, trainer
  from ..None import base
  from ..base import _NP_OP_PREFIX, _NP_OP_SUBMODULE_LIST, _NP_EXT_OP_PREFIX, _NP_EXT_OP_SUBMODULE_LIST, _NP_INTERNAL_OP_PREFIX, c_str_array, c_str, c_array_buf, SymbolHandle, check_call, _LIB
  from ..None import optimizer
  from .loss_scaler import LossScaler
  from ..operator import get_all_registered_operators_grouped
  from ..util import wrap_ctx_to_device_func
label_desc: Use image node_id 4 for calling a global function with example usage: _wrap_module_functions(module, is_numpy_module, target_dtype, get_aliases, get_cond_aliases, get_fun_to_wrap, target_precision_ops, conditional_fp32_ops, fp32_ops) and returns: _new_fun, _new_fun, _new_fun, f, wrapped_sym, f, f, f