code: def colorbar(self, mappable, **kwargs):
      locator = kwargs.pop("locator", None)
  
      if locator is None:
          if "ticks" not in kwargs:
              kwargs["ticks"] = ticker.MaxNLocator(5)
      if locator is not None:
          if "ticks" in kwargs:
              raise ValueError(
                  "Either *locator* or *ticks* need"
                  + " to be given, not both"
              )
          else:
              kwargs["ticks"] = locator
  
      self._hold = True
      if self.orientation in ["top", "bottom"]:
          orientation = "horizontal"
      else:
          orientation = "vertical"
  
      cb = Colorbar(self, mappable, orientation=orientation, **kwargs)
      self._config_axes()
  
      def on_changed(m):
          cb.set_cmap(m.get_cmap())
          cb.set_clim(m.get_clim())
          cb.update_bruteforce(m)
  
      self.cbid = mappable.callbacksSM.connect("changed", on_changed)
      mappable.colorbar = cb
  
      self.locator = cb.cbar_axis.get_major_locator()
  
      return cb
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import six
  import matplotlib.axes
  import matplotlib.cbook
  import matplotlib.ticker
  from matplotlib.gridspec import SubplotSpec
  from .axes_divider import Size, SubplotDivider, LocatableAxes, Divider
  from .colorbar import Colorbar
label_desc: Use image node_id 1 for calling the CbarAxesBase obj's underlying member method code with example usage: obj.colorbar(mappable) and returns: cb