code: def _create_heatmap(
      data: np.ndarray,
      xticklabels: List[str],
      yticklabels: List[str],
      linewidths: float = 3,
      linecolor: str = "w",
      cbar: bool = True,
      cbar_kws: Optional[dict] = None,
      cbar_ax: Optional["plt.Axes"] = None,
      cbar_label: str = "",
      ax: Optional["plt.Axes"] = None,
      **kwargs,
  ) -> "plt.Axes":
      """
      Create a heatmap from a `numpy` array and two lists of labels. The code is adapted from `matplotlib tutorials`_.
  
      .. _matplotlib tutorials:
          https://matplotlib.org/stable/gallery/images_contours_and_fields/image_annotated_heatmap.html
  
      Parameters
      ----------
      data
          A 2D `numpy` array of shape `M x N`.
      xticklabels
          A list or array of length `N` with the labels for the columns.
      yticklabels
          A list or array of length `M` with the labels for the rows.
      linewidths
          Width of the lines that will divide each cell. Default 3.
      linecolor
          Color of the lines that will divide each cell. Default ``'w'``.
      cbar
          Boolean flag whether to draw a colorbar.
      cbar_label
          Optional label for the colorbar.
      cbar_ax
          Optional axes in which to draw the colorbar, otherwise take space from the main axes.
      cbar_kws
          An optional dictionary with arguments to `matplotlib.figure.Figure.colorbar`_.
  
          .. _matplotlib.figure.Figure.colorbar:
              https://matplotlib.org/stable/api/figure_api.html#matplotlib.figure.Figure.colorbar
      ax
          Optional `matplotlib.axes.Axes` instance to which the heatmap is plotted. If not provided, use current
          axes or create a new one.
      **kwargs
          All other keyword arguments are passed to `matplotlib.axes.Axes.imshow`_.
  
          .. _matplotlib.axes.Axes.imshow:
              https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.imshow.html
      """
      if cbar_kws is None:
          cbar_kws = {}
  
      if not ax:
          ax = plt.gca()
  
      # plot the heatmap
      im = ax.imshow(data, **kwargs)
  
      # create colorbar
      if cbar:
          if cbar_ax is None:
              cbar_ax = ax
          cbar_obj = ax.figure.colorbar(im, ax=cbar_ax, **cbar_kws)  # type: ignore[union-attr]
          cbar_obj.ax.set_ylabel(cbar_label, rotation=-90, va="bottom")
  
      # show all ticks and label them with the respective list entries.
      ax.set_xticks(np.arange(data.shape[1]))
      ax.set_xticklabels(xticklabels)
      ax.set_yticks(np.arange(data.shape[0]))
      ax.set_yticklabels(yticklabels)
  
      # let the horizontal axes labeling appear on top.
      ax.tick_params(
          top=False, bottom=True, labeltop=False, labelbottom=True
      )
  
      # rotate the tick labels and set their alignment.
      plt.setp(
          ax.get_xticklabels(),
          rotation=90,
          ha="right",
          rotation_mode="anchor",
      )
  
      # turn spines off and create white grid.
      ax.spines[:].set_visible(False)
  
      ax.set_xticks(np.arange(data.shape[1] + 1) - 0.5, minor=True)
      ax.set_yticks(np.arange(data.shape[0] + 1) - 0.5, minor=True)
      ax.grid(
          which="minor",
          color=linecolor,
          linestyle="-",
          linewidth=linewidths,
      )
      ax.tick_params(which="minor", bottom=False, left=False)
  
      return ax
  
imports: import warnings
  from enum import Enum
  from typing import List, Optional, Tuple, Union
  import matplotlib
  import numpy
  from matplotlib import pyplot
  from matplotlib.colors import LinearSegmentedColormap
  from matplotlib.pyplot import Axes, Figure
  from mpl_toolkits.axes_grid1 import make_axes_locatable
  from numpy import ndarray
label_desc: Use image node_id 6 for calling a global function with example usage: _create_heatmap(data, xticklabels, yticklabels, linewidths, linecolor, cbar, cbar_kws, cbar_ax, cbar_label, ax) and returns: ax