code: def flatten(*, backend: str, ret):
      """Return a flattened numpy version of the arrays in ret."""
      if not isinstance(ret, tuple):
          ret = (ret,)
      with BackendHandler.update_backend(backend) as ivy_backend:
          ret_idxs = ivy_backend.nested_argwhere(
              ret, ivy_backend.is_ivy_array
          )
          # no ivy array in the returned values, which means it returned scalar
          if len(ret_idxs) == 0:
              ret_idxs = ivy_backend.nested_argwhere(
                  ret, ivy_backend.isscalar
              )
              ret_flat = ivy_backend.multi_index_nest(ret, ret_idxs)
              ret_flat = [
                  ivy_backend.asarray(
                      x,
                      dtype=ivy_backend.Dtype(str(np.asarray(x).dtype)),
                  )
                  for x in ret_flat
              ]
          else:
              ret_flat = ivy_backend.multi_index_nest(ret, ret_idxs)
      return ret_flat
  
imports: import copy
  import time
  from typing import Union, List, Optional
  import numpy
  import types
  import importlib
  import inspect
  from collections import OrderedDict
  from .globals import mod_backend
  from .pipeline_helper import BackendHandler, BackendHandlerMode, get_frontend_config
  import ivy
  from ivy_tests.test_ivy.helpers.test_parameter_flags import FunctionTestFlags
  import ivy_tests.test_ivy.helpers.test_parameter_flags
  import ivy_tests.test_ivy.helpers.globals
  from ivy.functional.ivy.data_type import _get_function_list, _get_functions_from_string
  from ivy_tests.test_ivy.test_frontends import NativeClass
  from ivy_tests.test_ivy.helpers.structs import FrontendMethodData
  from ivy_tests.test_ivy.helpers.testing_helpers import _create_transpile_report
  from .assertions import value_test, assert_same_type, check_unsupported_dtype
label_desc: Use image node_id 24 for calling a global function with example usage: flatten() and returns: ret_flat