code: def _find_associated_colorbar(obj):
      
      for child in obj.get_children():
          try:
              cbar = child.colorbar
          except AttributeError:
              continue
          if cbar is not None:  # really necessary?
              # if fetch was successful, cbar contains
              # (reference to colorbar,
              #   reference to axis containing colorbar)
              return cbar
      return None
docs: A rather poor way of telling whether an axis has a colorbar associated:
      Check the next axis environment, and see if it is de facto a color bar;
      if yes, return the color bar object.