code: def _is_colorbar_heuristic(obj):
      
      # TODO come up with something more accurate here
      # Might help:
      # TODO Are the colorbars exactly the l.collections.PolyCollection's?
      try:
          aspect = float(obj.get_aspect())
      except ValueError:
          # e.g., aspect == 'equal'
          return False
  
      # Assume that something is a colorbar if and only if the ratio is above 5.0
      # and there are no ticks on the corresponding axis. This isn't always true,
      # though: The ratio of a color can be freely adjusted by the aspect
      # keyword, e.g.,
      #
      #    plt.colorbar(im, aspect=5)
      #
      limit_ratio = 5.0
  
      return (aspect >= limit_ratio and len(obj.get_xticks()) == 0) or (
          aspect <= 1.0 / limit_ratio and len(obj.get_yticks()) == 0
      )
docs: Find out if the object is in fact a color bar.