code: def _convert_agg_to_wx_image(agg, bbox):
      """
      Convert the region of the agg buffer bounded by bbox to a wx.Image.  If
      bbox is None, the entire buffer is converted.
  
      Note: agg must be a backend_agg.RendererAgg instance.
      """
      if bbox is None:
          # agg => rgb -> image
          image = wxc.EmptyImage(int(agg.width), int(agg.height))
          image.SetData(agg.tostring_rgb())
          return image
      else:
          # agg => rgba buffer -> bitmap => clipped bitmap => image
          return wx.ImageFromBitmap(
              _WX28_clipped_agg_as_bitmap(agg, bbox)
          )
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import six
  import wx
  import matplotlib
  from matplotlib import cbook
  from .None import wx_compat
  from .backend_agg import FigureCanvasAgg
  from .backend_wx import _BackendWx, _FigureCanvasWxBase, FigureFrameWx, NavigationToolbar2Wx
label_desc: Use image node_id 1 for calling a global function with example usage: _convert_agg_to_wx_image(agg, bbox) and returns: image, wx