code: def mask_zero_div_zero(x, y, result, copy=False):
      """
      Set results of 0 / 0 or 0 // 0 to np.nan, regardless of the dtypes
      of the numerator or the denominator.
  
      Parameters
      ----------
      x : ndarray
      y : ndarray
      result : ndarray
      copy : bool (default False)
          Whether to always create a new array or try to fill in the existing
          array if possible.
  
      Returns
      -------
      filled_result : ndarray
  
      Examples
      --------
      >>> x = np.array([1, 0, -1], dtype=np.int64)
      >>> y = 0       # int 0; numpy behavior is different with float
      >>> result = x / y
      >>> result      # raw numpy result does not fill division by zero
      array([0, 0, 0])
      >>> mask_zero_div_zero(x, y, result)
      array([ inf,  nan, -inf])
      """
      if is_scalar(y):
          y = np.array(y)
  
      zmask = y == 0
      if zmask.any():
          shape = result.shape
  
          nan_mask = (zmask & (x == 0)).ravel()
          neginf_mask = (zmask & (x < 0)).ravel()
          posinf_mask = (zmask & (x > 0)).ravel()
  
          if nan_mask.any() or neginf_mask.any() or posinf_mask.any():
              # Fill negative/0 with -inf, positive/0 with +inf, 0/0 with NaN
              result = result.astype("float64", copy=copy).ravel()
  
              np.putmask(result, nan_mask, np.nan)
              np.putmask(result, posinf_mask, np.inf)
              np.putmask(result, neginf_mask, -np.inf)
  
              result = result.reshape(shape)
  
      return result
  
imports: from distutils.version import LooseVersion
  import operator
  import numpy
  from pandas._libs import algos, lib
  from pandas.compat import range, string_types
  from pandas.core.dtypes.cast import infer_dtype_from_array
  from pandas.core.dtypes.common import ensure_float64, is_datetime64_dtype, is_datetime64tz_dtype, is_float_dtype, is_integer, is_integer_dtype, is_numeric_v_string_like, is_scalar, is_timedelta64_dtype, needs_i8_conversion
  from pandas.core.dtypes.missing import isna
label_desc: Use image node_id 18 for calling a global function with example usage: mask_zero_div_zero(x, y, result, copy) and returns: result