code: def clip(
      x: Union[ivy.Array, ivy.NativeArray],
      /,
      x_min: Optional[Union[Number, ivy.Array, ivy.NativeArray]] = None,
      x_max: Optional[Union[Number, ivy.Array, ivy.NativeArray]] = None,
      *,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """Clips (limits) the values in an array.
  
      Given an interval, values outside the interval are clipped to the interval edges
      (element-wise). For example, if an interval of [0, 1] is specified, values smaller
      than 0 become 0, and values larger than 1 become 1. Minimum value needs to smaller
      or equal to maximum value to return correct results.
  
      Parameters
      ----------
      x
          Input array containing elements to clip.
      x_min
          Minimum value.
      x_max
          Maximum value.
      out
          optional output array, for writing the result to. It must have a shape that the
          inputs broadcast to.
  
      Returns
      -------
      ret
          An array with the elements of x, but where values < x_min are replaced with
          x_min, and those > x_max with x_max.
  
  
      Both the description and the type hints above assumes an array input for simplicity,
      but this function is *nestable*, and therefore also accepts :class:`ivy.Container`
      instances in place of any of the arguments.
  
      Examples
      --------
      With :class:`ivy.Array` input:
  
      >>> x = ivy.array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
      >>> y = ivy.clip(x, 1., 5.)
      >>> print(y)
      ivy.array([1., 1., 2., 3., 4., 5., 5., 5., 5., 5.])
  
      >>> x = ivy.array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
      >>> y = ivy.zeros_like(x)
      >>> ivy.clip(x, 2., 7., out=y)
      >>> print(y)
      ivy.array([2., 2., 2., 3., 4., 5., 6., 7., 7., 7.])
  
      >>> x = ivy.array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
      >>> x_min = ivy.array([3., 3., 1., 0., 2., 3., 4., 0., 4., 4.])
      >>> x_max = ivy.array([5., 4., 3., 3., 5., 7., 8., 3., 8., 8.])
      >>> y = ivy.clip(x, x_min, x_max)
      >>> print(y)
      ivy.array([3., 3., 2., 3., 4., 5., 6., 3., 8., 8.])
  
      With :class:`ivy.NativeArray` input:
  
      >>> x = ivy.native_array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
      >>> x_min = ivy.native_array([3., 3., 1., 0., 2., 3., 4., 2., 4., 4.])
      >>> x_max = ivy.native_array([5., 4., 3., 3., 5., 7., 8., 3., 8., 8.])
      >>> y = ivy.clip(x, x_min, x_max)
      >>> print(y)
      ivy.array([3., 3., 2., 3., 4., 5., 6., 3., 8., 8.])
  
      With a mix of :class:`ivy.Array` and :class:`ivy.NativeArray` inputs:
  
      >>> x = ivy.array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
      >>> x_min = ivy.native_array([3., 3., 1., 0., 2., 3., 4., 2., 4., 4.])
      >>> x_max = ivy.native_array([5., 4., 3., 3., 5., 7., 8., 3., 8., 8.])
      >>> y = ivy.clip(x, x_min, x_max)
      >>> print(y)
      ivy.array([3., 3., 2., 3., 4., 5., 6., 3., 8., 8.])
  
      With :class:`ivy.Container` input:
  
      >>> x = ivy.Container(a=ivy.array([0., 1., 2.]),
      ...                   b=ivy.array([3., 4., 5.]))
      >>> y = ivy.clip(x, 1., 5.)
      >>> print(y)
      {
          a: ivy.array([1., 1., 2.]),
          b: ivy.array([3., 4., 5.])
      }
  
      With multiple :class:`ivy.Container` inputs:
  
      >>> x = ivy.Container(a=ivy.array([0., 1., 2.]),
      ...                   b=ivy.array([3., 4., 5.]))
      >>> x_min = ivy.Container(a=0, b=-3)
      >>> x_max = ivy.Container(a=1, b=-1)
      >>> y = ivy.clip(x, x_min,x_max)
      >>> print(y)
      {
          a: ivy.array([0., 1., 1.]),
          b: ivy.array([-1., -1., -1.])
      }
  
      With a mix of :class:`ivy.Array` and :class:`ivy.Container` inputs:
  
      >>> x = ivy.array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
      >>> x_min = ivy.array([3., 0., 1])
      >>> x_max = ivy.array([5., 4., 3.])
      >>> y = ivy.Container(a=ivy.array([0., 1., 2.]),
      ...                   b=ivy.array([3., 4., 5.]))
      >>> z = ivy.clip(y, x_min, x_max)
      >>> print(z)
      {
          a: ivy.array([3., 1., 2.]),
          b: ivy.array([3., 4., 3.])
      }
      """
      return current_backend(x).clip(x, x_min, x_max, out=out)
  
imports: from typing import Union, Optional, Tuple, List, Iterable, Sequence
  from numbers import Number
  from numpy.core.numeric import normalize_axis_tuple
  import ivy
  from ivy.utils.backend import current_backend
  from ivy.func_wrapper import handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_view, 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: clip(x_min, x_max) and returns: current_backend