code: def _ivy_to_native(x):
      # checks the first element of the leaf list and
      # converts it to a native array if it is an ivy array
      # assumes that either all elements in a leaf list are ivy arrays
      # or none of them are
      if (
          isinstance(x, (list, tuple))
          and len(x) != 0
          and isinstance(x[0], (list, tuple))
      ):
          for i, item in enumerate(x):
              x = list(x) if isinstance(x, tuple) else x
              x[i] = _ivy_to_native(item)
      elif (
          isinstance(x, (list, tuple)) and len(x) > 0
      ) and ivy.is_ivy_array(x[0]):
          x = ivy.to_native(x, nested=True)
      elif ivy.is_ivy_array(x):
          x = ivy.to_native(x)
      return x
  
imports: from __future__ import annotations
  import functools
  from numbers import Number
  from typing import Union, Tuple, Optional, List, Sequence, Callable, Protocol, TypeVar, Iterable
  import numpy
  import ivy
  from ivy import to_ivy
  from ivy.utils.exceptions import handle_exceptions
  from ivy.utils.backend import current_backend
  from ivy.func_wrapper import handle_array_function, infer_dtype, handle_out_argument, outputs_to_ivy_arrays, inputs_to_native_arrays, inputs_to_native_shapes, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid, temp_asarray_wrapper
label_desc: Use image node_id 2 for calling a global function with example usage: _ivy_to_native(x) and returns: x