code: def set_style(key):
      """
      Select a style by name, e.g. set_style('default'). To revert to the
      previous style use the key 'unset' or False.
      """
      if key is None:
          return
      elif not key or key in ["unset", "backup"]:
          if "backup" in styles:
              plt.rcParams.update(styles["backup"])
          else:
              raise Exception("No style backed up to restore")
      elif key not in styles:
          raise KeyError("%r not in available styles.")
      else:
          path = os.path.join(os.path.dirname(__file__), styles[key])
          new_style = rc_params_from_file(
              path, use_default_template=False
          )
          styles["backup"] = dict(plt.rcParams)
  
          plt.rcParams.update(new_style)
  
imports: import os
  from colorcet import kbc, register_cmap
  from matplotlib import rc_params_from_file
  from matplotlib.colors import LinearSegmentedColormap, ListedColormap
  from packaging.version import Version
  from param import concrete_descendents
  from ...core import Collator, GridMatrix, Layout, config
  from ...core.options import Cycle, Options, Palette
  from ...core.overlay import NdOverlay, Overlay
  from ...element import *
  from ..plot import PlotSelector
  from ..util import fire_colors
  from .annotation import *
  from .chart import *
  from .chart3d import *
  from .element import ElementPlot
  from .geometry import *
  from .graphs import *
  from .heatmap import *
  from .hex_tiles import *
  from .path import *
  from .plot import *
  from .raster import *
  from .renderer import MPLRenderer
  from .sankey import *
  from .stats import *
  from .tabular import *
label_desc: Use image node_id 1 for calling a global function with example usage: set_style(key) without return types