code: def gamma(arr, g):
      r
      if (arr.max() > 1.0 + epsilon) or (arr.min() < 0 - epsilon):
          raise ValueError("Input array must have float values between 0 and 1")
      if g <= 0 or np.isnan(g):
          raise ValueError("gamma must be greater than 0")
  
      return arr ** (1.0 / g)
docs: r"""
      Gamma correction is a nonlinear operation that
      adjusts the image's channel values pixel-by-pixel according
      to a power-law:
  
      .. math:: pixel_{out} = pixel_{in} ^ {\gamma}
  
      Setting gamma (:math:`\gamma`) to be less than 1.0 darkens the image and
      setting gamma to be greater than 1.0 lightens it.
  
      Parameters
      ----------
      gamma (:math:`\gamma`): float
          Reasonable values range from 0.8 to 2.4.