code: def expand_heatmap(heatmap, image, resampling_filter=Image.LANCZOS):
      # type: (np.ndarray, Image, Union[None, int]) -> Image
      """
      Resize the ``heatmap`` image array to fit over the original ``image``,
      using the specified ``resampling_filter`` method.
      The heatmap is converted to an image in the process.
  
      Parameters
      ----------
      heatmap : numpy.ndarray
          Heatmap that is to be resized, as an array.
  
      image : PIL.Image.Image
          The image whose dimensions will be resized to.
  
      resampling_filter : int or None
          Interpolation to use when resizing.
  
          See :func:`eli5.format_as_image` for more details on the `resampling_filter` parameter.
  
  
      :raises TypeError: if ``image`` is not a Pillow image instance.
  
  
      Returns
      -------
      resized_heatmap : PIL.Image.Image
          The heatmap, resized, as a PIL image.
      """
      if not isinstance(image, Image.Image):
          raise TypeError(
              "image must be a PIL.Image.Image instance. "
              "Got: {}".format(image)
          )
      heatmap = heatmap_to_image(heatmap)
      spatial_dimensions = (image.width, image.height)
      heatmap = heatmap.resize(
          spatial_dimensions, resample=resampling_filter
      )
      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 7 for calling a global function with example usage: expand_heatmap(heatmap, image, resampling_filter) and returns: heatmap