code: def set_state(state):
      """
      A context manager that sets the state of the backends to one returned by :obj:`get_state`.
  
      See Also
      --------
      get_state
          Gets a state to be set by this context manager.
      """  # noqa: E501
      old_state = get_state()
      _uarray.set_state(state)
      try:
          yield
      finally:
          _uarray.set_state(old_state, True)
  
imports: import typing
  import types
  import inspect
  import functools
  from .None import _uarray
  import copyreg
  import pickle
  import contextlib
  from ._uarray import BackendNotImplementedError, _Function, _SkipBackendContext, _SetBackendContext, _BackendState
label_desc: Use image node_id 8 for calling a global function with example usage: set_state(state) without return types