code: def clustered_corrmap(
      corr,
      cls,
      label_attr_name="labels_",
      figsize=(10, 8),
      annotate=False,
      inflate=False,
      linewidths=0.5,
      cbar_kws="default",
      show=True,
      title_fontsize=14,
      title_name="Clustered correlation heatmap",
      ax=None,
      **kwargs,
  ):
      """Function for plotting a clustered correlation heatmap.
  
      Parameters
      ----------
      corr : array-like of shape = [n_features, n_features]
          Input correlation matrix. Pass a pandas ``DataFrame`` for axis labels.
  
      cls : instance
          cluster estimator with a ``fit`` method and cluster labels stored as an
          attribute as specified by the ``label_attr_name`` parameter.
  
      label_attr_name : str
          name of attribute that contains cluster labels.
  
      figsize : tuple (default = (10, 8))
          Size of figure.
  
      annotate : bool (default = True)
          Whether to print the correlation coefficients.
  
      inflate : bool (default = True)
          Whether to inflate correlation coefficients to a 0-100 scale.
          Avoids decimal points in the figure, which often appears very cluttered
          otherwise.
  
      linewidths : float (default = .5)
          with of line separating each coordinate square.
  
      cbar_kws : dict, str (default = 'default')
          Optional arguments to color bar.
  
      title_name : str
          Figure title.
  
      title_fontsize : int
          size of title.
  
      show : bool (default = True)
          whether to print figure using :obj:`matplotlib.pyplot.show`.
  
      ax : object, optional
          axis to attach plot to.
  
      **kwargs : optional
          Other optional arguments to sns heatmap.
  
      See Also
      --------
      :class:`mlens.visualization.corrmat`
      """
      # find closely associated features
      cls.fit(corr)
  
      # Sort features on cluster membership
      if corr.__class__.__name__ == "DataFrame":
          columns_names = corr.columns.tolist()
      else:
          columns_names = [i for i in range(corr.shape[1])]
  
      corr_list = [
          tup[0]
          for tup in sorted(
              zip(columns_names, getattr(cls, label_attr_name)),
              key=lambda x: x[1],
          )
      ]
  
      if corr.__class__.__name__ == "DataFrame":
          corr = corr.loc[corr_list, corr_list]
      else:
          corr = corr[np.ix_(corr_list, corr_list)]
  
      # Prepare figure
      if inflate:
          corr *= 100
          fmt = "2.0f"
      else:
          fmt = ".2f"
  
      if cbar_kws == "default":
          cbar_kws = {"shrink": 1.0}
  
      # Determine annotation
      do_annot = {True: corr, False: None}
      annot = do_annot[annotate]
  
      # Generate a custom diverging colormap
      cmap = diverging_palette(220, 10, as_cmap=True)
  
      if ax is None:
          _, ax = plt.subplots(figsize=figsize)
  
      ax = heatmap(
          corr,
          cmap=cmap,
          vmin=corr.min().min(),
          annot=annot,
          fmt=fmt,
          vmax=corr.max().max(),
          square=True,
          linewidths=linewidths,
          cbar_kws=cbar_kws,
          ax=ax,
          **kwargs,
      )
  
      if show:
          plt.title(title_name, fontsize=title_fontsize)
          plt.show()
  
      return ax
  
imports: from __future__ import division, print_function
  import numpy
  from scipy.stats import pearsonr
  import warnings
label_desc: Use image node_id 2 for calling a global function with example usage: clustered_corrmap(corr, cls, label_attr_name, figsize, annotate, inflate, linewidths, cbar_kws, show, title_fontsize, title_name, ax) and returns: ax