code: def _process_func_ret_and_grads(func_ret, grads, retain_grads):
      """Stop gradients propagation.
  
      Set the gradients of non-finite values to zero, and stopping
      gradient propagation of the function results.
      """
      grads = _non_finite_to_zero(grads)
      func_ret, grads = _stop_grad_and_index(
          func_ret, retain_grads, grads
      )
      grads = _to_ivy(grads)
      return func_ret, grads
  
imports: from typing import Sequence, Union, Optional, Tuple, Callable
  import numpy
  import itertools
  import ivy
  from ivy.utils.backend import current_backend
  from ivy.func_wrapper import handle_array_function, inputs_to_ivy_arrays, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 10 for calling a global function with example usage: _process_func_ret_and_grads(func_ret, grads, retain_grads) and returns: func_ret,  grads