code: def reinhard_to_srgb(
      img, saturation=1.25, white=100, **kwargs
  ):  # noqa: D417
      """Stretch method based on the Reinhard algorithm, using luminance.
  
      Args:
          saturation: Saturation enhancement factor. Less is grayer. Neutral is 1.
          white: the reflectance luminance to set to white (in %).
  
  
      Reinhard, Erik & Stark, Michael & Shirley, Peter & Ferwerda, James. (2002).
      Photographic Tone Reproduction For Digital Images. ACM Transactions on Graphics.
      :doi: `21. 10.1145/566654.566575`
      """
      with xr.set_options(keep_attrs=True):
          # scale the data to [0, 1] interval
          rgb = img.data / 100
          white /= 100
  
          # extract color components
          r = rgb.sel(bands="R").data
          g = rgb.sel(bands="G").data
          b = rgb.sel(bands="B").data
  
          # saturate
          luma = _compute_luminance_from_rgb(r, g, b)
          rgb = (luma + (rgb - luma) * saturation).clip(0)
  
          # reinhard
          reinhard_luma = (luma / (1 + luma)) * (
              1 + luma / (white**2)
          )
          coef = reinhard_luma / luma
          rgb = rgb * coef
  
          # srgb gamma
          rgb.data = _srgb_gamma(rgb.data)
          img.data = rgb
  
      return img.data
  
imports: import logging
  import os
  from collections import namedtuple
  from functools import wraps
  from numbers import Number
  from typing import Optional
  import dask
  import dask.array
  import numpy
  import xarray
  from trollimage.colormap import Colormap
  from trollimage.xrimage import XRImage
  from satpy._compat import ArrayLike
  from satpy._config import get_config_path
  from satpy.utils import find_in_ancillary
label_desc: Use image node_id 12 for calling a global function with example usage: reinhard_to_srgb(img, saturation, white) and returns: img