code: def open_and_reorient_image(handle):
      
      # Retrieve tags from the Exchangeable image file format (Exif)
      # included in the picture.  If the orientation of the picture is not
      # top left side, rotate it accordingly.
  
      # @deprecated
      # exif_tags = dict([ (exif_tag.tag, exif_tag)
      #     for exif_tag in exif.process_file(handle).itervalues()
      #         if hasattr(exif_tag, 'tag') ])
  
      exif_tags = exifread.process_file(handle)
      exif_tag_orientation = exif_tags.get(EXIF_TAG_ORIENTATION)
  
      rotation_angle = exif_tag_orientation and {
              3L: 180,
              6L: 270,
              8L: 90
          }.get(exif_tag_orientation.values[0])
  
      handle.seek(0) # exif.process_file has updated the file's current position.
      image = Image.open(handle)
  
      return image if rotation_angle is None else image.rotate(rotation_angle)
docs: Load the image from the specified file and orient the image accordingly
      to the Exif tag that the file might embed, which would indicate the
      orientation of the camera relative to the captured scene.
  
  
      @param handle: a Python file object.
  
  
      @return: an instance returned by the Python Library Image library.