code: def _colorize(heatmap, colormap):
      # type: (np.ndarray, Callable[[np.ndarray], np.ndarray]) -> np.ndarray
      """
      Apply the ``colormap`` function to a grayscale
      rank 2 ``heatmap`` array (with float values in interval [0, 1]).
      Returns an RGBA rank 3 array with float values in range [0, 1].
      """
      heatmap = colormap(heatmap)  # -> [0, 1] RGBA ndarray
      return heatmap
  
file_path: eli5/eli5/formatters/image.py
imports: from __future__ import absolute_import
  from typing import Union, Optional, Callable
  import numpy
  from PIL import Image
  import matplotlib.cm
  from eli5.base import Explanation
label_desc: Use image node_id 4 for calling a global function with example usage: _colorize(heatmap, colormap) and returns: heatmap