code: def apply_func(is_module, func, xp, device, input, axis, dtypes):
      (in_dtype,), out_dtype = dtypes
      try:
          a_np = input.astype(in_dtype)
      except (ValueError, OverflowError):
          return xp.zeros(())  # invalid combination of data and dtype
  
      a = xp.array(a_np)
      a = func(is_module, xp, a, axis)
      if xp is numpy:
          a = dtype_utils.cast_if_numpy_array(xp, a, out_dtype)
      return a
  
imports: import chainer
  import numpy
  import pytest
  import chainerx
  import chainerx.testing
  from chainerx_tests import array_utils
  from chainerx_tests import dtype_utils
  from chainerx_tests import math_utils
  from chainerx_tests import op_utils
label_desc: Use image node_id 5 for calling a global function with example usage: apply_func(is_module, func, xp, device, input, axis, dtypes) and returns: a, xp