code: def rotate(self, deg, **kwargs):
          
          opts = Image._normalize_options(kwargs)
  
          if deg == "auto":
              if self._orig_format == "JPEG":
                  try:
                      exif = self.img._getexif() or dict()
                      deg = _orientation_to_rotation.get(exif.get(274, 0), 0)
                  except Exception:
                      logger.warn('unable to parse exif')
                      deg = 0
              else:
                  deg = 0
  
          deg = 360 - (int(deg) % 360)
          if deg % 90 == 0:
              if deg == 90:
                  self.img = self.img.transpose(PIL.Image.ROTATE_90)
              elif deg == 180:
                  self.img = self.img.transpose(PIL.Image.ROTATE_180)
              elif deg == 270:
                  self.img = self.img.transpose(PIL.Image.ROTATE_270)
          else:
              self.img = self.img.rotate(deg, expand=bool(int(opts["expand"])))
  
          return self
docs: Rotates the image clockwise around its center.  Returns the
          instance. Supports the following optional keyword arguments:
  
          expand - Expand the output image to fit rotation