code: def xyz2lab(xyz, dtype=None):
      """
      lab = xyz2lab(xyz, dtype={float})
  
      Convert CIE XYZ to L*a*b* coordinates
  
      https://en.wikipedia.org/wiki/CIELAB
  
      Parameters
      ----------
      xyz : ndarray
      dtype : dtype, optional
          What dtype to return. Default will be floats
  
      Returns
      -------
      lab : ndarray
      """
      _check_3(xyz, "xyz2lab")
      x, y, z = xyz.transpose((2, 0, 1))
  
      def f(t):
          branch_large = t ** (1.0 / 3)
          branch_small = (
              (1 / 3.0) * (29.0 / 6) * (29.0 / 6)
          ) * t + 4 / 29.0
          return np.choose(
              t <= (6.0 / 29) ** 2, [branch_small, branch_large]
          )
  
      xn, yn, zn = 0.95047, 1.0, 1.08883
      fx = f(x / xn)
      fy = f(y / yn)
      fz = f(z / zn)
      L = 116 * fy - 16
      a = 500 * (fx - fy)
      b = 200 * (fy - fz)
      Lab = np.dstack([L, a, b])
      if dtype is not None:
          Lab = Lab.astype(dtype, copy=False)
      return Lab
  
file_path: mahotas/mahotas/colors.py
imports: from __future__ import division
  import numpy
  from .internal import _check_3
label_desc: Use image node_id 5 for calling a global function with example usage: xyz2lab(xyz, dtype) and returns: Lab, np