code: def with_backend(backend: str, cached: bool = True):
      # Use already compiled object
      if cached and backend in compiled_backends:
          cached_backend = compiled_backends[backend][-1]
          return cached_backend
      with _importlib.LocalIvyImporter():
          ivy_pack = _importlib._import_module("ivy")
          ivy_pack._is_local_pkg = True
          ivy_pack._compiled_id = id(ivy_pack)
          backend_module = _importlib._import_module(
              ivy_pack.utils.backend.handler._backend_dict[backend],
              ivy_pack.__package__,
          )
          _handle_backend_specific_vars(ivy_pack, backend_module)
          set_backend_to_specific_version(backend_module)
          # We know for sure that the backend stack is empty
          # no need to do backend unsetting
          ivy_pack.utils.backend.handler._set_module_backend(
              ivy_pack.__dict__.copy(), ivy_pack, backend_module
          )
          # TODO use a refactored code from ivy.set_backend
          for key in ivy_pack.__dict__.keys():
              if (
                  key in ivy_pack.functional.__dict__
                  and not key.startswith("__")
              ):
                  ivy_pack.functional.__dict__[
                      key
                  ] = ivy_pack.ivy.__dict__[key]
          ivy_pack.backend_stack.append(backend_module)
          ivy_pack.utils.backend._importlib.import_cache = copy.copy(
              _importlib.import_cache
          )
          _compiled_backends_ids[ivy_pack._compiled_id] = ivy_pack
          _importlib._clear_cache()
      try:
          compiled_backends[backend].append(ivy_pack)
      except KeyError:
          compiled_backends[backend] = [ivy_pack]
      if ivy.backend != backend:
          # to avoid warning users when not using set_backend with ivy.Array.__repr__
          _handle_inplace_mode(ivy_pack=ivy_pack)
      return ivy_pack
  
imports: import os
  import copy
  import types
  import ivy
  import importlib
  import functools
  import numpy
  import gc
  from ivy.utils import _importlib, verbosity
  from ivy.func_wrapper import _wrap_function
  from ivy.utils.backend.sub_backend_handler import _clear_current_sub_backends, fn_name_from_version_specific_fn_name
  from ivy.utils.exceptions import _handle_inplace_mode
label_desc: Use image node_id 20 for calling a global function with example usage: with_backend(backend, cached) and returns: ivy_pack, cached_backend