code: def _update_alpha(image_array, starting_array=None, alpha_limit=None):
      # type: (np.ndarray, Optional[np.ndarray], Optional[Union[float, int]]) -> None
      """
      Update the alpha channel values of an RGBA rank 3 ndarray ``image_array``,
      optionally creating the alpha channel from rank 2 ``starting_array``,
      and setting upper limit for alpha values (opacity) to ``alpha_limit``.
  
      This function modifies ``image_array`` in-place.
      """
      # FIXME: this function may be too specialized and could be refactored
      # get the alpha channel slice
      if isinstance(starting_array, np.ndarray):
          alpha = starting_array
      else:
          # take the alpha channel as is
          alpha = image_array[:, :, 3]
      # set maximum alpha value
      alpha = _cap_alpha(alpha, alpha_limit)
      # update alpha channel in the original image
      image_array[:, :, 3] = alpha
  
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 5 for calling a global function with example usage: _update_alpha(image_array, starting_array, alpha_limit) without return types