code: def xyz2lab(xyz, illuminant="D65", observer="2"):
      """XYZ to CIE-LAB color space conversion.
      Parameters
      ----------
      xyz : array_like
          The image in XYZ format, in a 3- or 4-D array of shape
          ``(.., ..,[ ..,] 3)``.
      illuminant : {"A", "D50", "D55", "D65", "D75", "E"}, optional
          The name of the illuminant (the function is NOT case sensitive).
      observer : {"2", "10"}, optional
          The aperture angle of the observer.
      Returns
      -------
      out : ndarray
          The image in CIE-LAB format, in a 3- or 4-D array of shape
          ``(.., ..,[ ..,] 3)``.
      Raises
      ------
      ValueError
          If `xyz` is not a 3-D array of shape ``(.., ..,[ ..,] 3)``.
      ValueError
          If either the illuminant or the observer angle is unsupported or
          unknown.
      Notes
      -----
      By default Observer= 2A, Illuminant= D65. CIE XYZ tristimulus values
      x_ref=95.047, y_ref=100., z_ref=108.883. See function `get_xyz_coords` for
      a list of supported illuminants.
      References
      ----------
      .. [1] http://www.easyrgb.com/index.php?X=MATH&H=07#text7
      .. [2] https://en.wikipedia.org/wiki/Lab_color_space
      Examples
      --------
      >>> from skimage import data
      >>> from skimage.color import rgb2xyz, xyz2lab
      >>> img = data.astronaut()
      >>> img_xyz = rgb2xyz(img)
      >>> img_lab = xyz2lab(img_xyz)
      """
      arr = _prepare_colorarray(xyz)
  
      xyz_ref_white = get_xyz_coords(illuminant, observer)
  
      # scale by CIE XYZ tristimulus values of the reference white point
      arr = arr / xyz_ref_white
  
      # Nonlinear distortion and linear transformation
      mask = arr > 0.008856
      arr[mask] = np.cbrt(arr[mask])
      arr[~mask] = 7.787 * arr[~mask] + 16.0 / 116.0
  
      x, y, z = arr[..., 0], arr[..., 1], arr[..., 2]
  
      # Vector scaling
      L = (116.0 * y) - 16.0
      a = 500.0 * (x - y)
      b = 200.0 * (y - z)
  
      return np.concatenate(
          [x[..., np.newaxis] for x in [L, a, b]], axis=-1
      )
  
imports: import numpy
  from scipy import linalg
  from warnings import warn
label_desc: Use image node_id 3 for calling a global function with example usage: xyz2lab(xyz, illuminant, observer) and returns: np