code: def set_backend(backend, coerce=False, only=False):
      """
      A context manager that sets the preferred backend.
  
      Parameters
      ----------
      backend
          The backend to set.
      coerce
          Whether or not to coerce to a specific backend's types. Implies ``only``.
      only
          Whether or not this should be the last backend to try.
  
      See Also
      --------
      skip_backend : A context manager that allows skipping of backends.
      set_global_backend : Set a single, global backend for a domain.
      """
      try:
          return backend.__ua_cache__["set", coerce, only]
      except AttributeError:
          backend.__ua_cache__ = {}
      except KeyError:
          pass
  
      ctx = _SetBackendContext(backend, coerce, only)
      backend.__ua_cache__["set", coerce, only] = ctx
      return ctx
  
imports: import typing
  import inspect
  import functools
  from .None import _uarray
  import copyreg
  import atexit
  import pickle
  from ._uarray import BackendNotImplementedError, _Function, _SkipBackendContext, _SetBackendContext
label_desc: Use image node_id 5 for calling a global function with example usage: set_backend(backend, coerce, only) and returns: ctx, backend