code: def decorate_plot_result(res=None, figure=None):
      def get_figure():
          if figure is not RAISE_ON_FIGURE_ACCESS:
              return figure
          else:
              raise H2OError("Cannot plot, matplotlib is absent!")
  
      # list all special/immutable types that we need first
      if res is None:
          dec = _MObject()
      elif isinstance(res, tuple):
          dec = _MTuple(res)
      elif isinstance(res, list):
          dec = _MList(res)
      elif isinstance(res, dict):
          dec = _MDict(res)
      elif isinstance(res, str):
          dec = _MStr(res)
      else:  # should be an H2O instance, should be mutable
          dec = res
      dec.figure = get_figure
      dec._is_decorated_plot_result = True
  
      return dec
  
file_path: h2o-3/h2o-py/h2o/plot/_plot_result.py
imports: from h2o.exceptions import H2OError
label_desc: Use image node_id 1 for calling a global function with example usage: decorate_plot_result(res, figure) and returns: dec, figure