code: def adjust_gamma(
      img: Image.Image,
      gamma: float,
      gain: float = 1.0,
  ) -> Image.Image:
      if not _is_pil_image(img):
          raise TypeError(f"img should be PIL Image. Got {type(img)}")
  
      if gamma < 0:
          raise ValueError("Gamma should be a non-negative real number")
  
      input_mode = img.mode
      img = img.convert("RGB")
      gamma_map = [
          int((255 + 1 - 1e-3) * gain * pow(ele / 255.0, gamma))
          for ele in range(256)
      ] * 3
      img = img.point(
          gamma_map
      )  # use PIL's point-function to accelerate this part
  
      img = img.convert(input_mode)
      return img
  
imports: import numbers
  from typing import Any, Dict, List, Literal, Optional, Sequence, Tuple, Union
  import numpy
  import torch
  from PIL import Image, ImageEnhance, ImageOps
label_desc: Use image node_id 11 for calling a global function with example usage: adjust_gamma(img, gamma, gain) and returns: img