code: def apply_RGB_matrix(var1, var2, var3, rgb_type, convtype="xyz_to_rgb"):
      
      convtype = convtype.lower()
      # Retrieve the appropriate transformation matrix from the constants.
      rgb_matrix = rgb_type.conversion_matrices[convtype]
  
      logger.debug("  \* Applying RGB conversion matrix: %s->%s",
                   rgb_type.__class__.__name__, convtype)
      # Stuff the RGB/XYZ values into a NumPy matrix for conversion.
      var_matrix = numpy.array((
          var1, var2, var3
      ))
      # Perform the adaptation via matrix multiplication.
      result_matrix = numpy.dot(rgb_matrix, var_matrix)
      rgb_r, rgb_g, rgb_b = result_matrix
      # Clamp these values to a valid range.
      rgb_r = max(rgb_r, 0.0)
      rgb_g = max(rgb_g, 0.0)
      rgb_b = max(rgb_b, 0.0)
      return rgb_r, rgb_g, rgb_b
docs: Applies an RGB working matrix to convert from XYZ to RGB.
      The arguments are tersely named var1, var2, and var3 to allow for the
      passing of XYZ _or_ RGB values. var1 is X for XYZ, and R for RGB. var2 and
      var3 follow suite.