code: def exif_transpose(image: Image.Image):
      """
      Transpose a PIL image accordingly if it has an EXIF Orientation tag.
      Inplace version of https://github.com/python-pillow/Pillow/blob/master/src/PIL/ImageOps.py exif_transpose()
      :param image: The image to transpose.
      :return: An image.
      """
      exif = image.getexif()
      orientation = exif.get(0x0112, 1)  # default 1
      if orientation > 1:
          method = {
              2: Image.FLIP_LEFT_RIGHT,
              3: Image.ROTATE_180,
              4: Image.FLIP_TOP_BOTTOM,
              5: Image.TRANSPOSE,
              6: Image.ROTATE_270,
              7: Image.TRANSVERSE,
              8: Image.ROTATE_90,
          }.get(orientation)
          if method is not None:
              image = image.transpose(method)
              del exif[0x0112]
              image.info["exif"] = exif.tobytes()
      return image
  
imports: import copy
  import os
  import random
  import time
  from typing import List, Optional, Union
  import cv2
  import numpy
  import requests
  from PIL import Image
  from sahi.utils.file import Path
label_desc: Use image node_id 16 for calling a global function with example usage: exif_transpose(image) and returns: image