code: def auto_orient(self):
          
          image = self.get_image()
          if image is None:
              return
          invert_y = not isinstance(image, AstroImage.AstroImage)
  
          # Check for various things to set based on metadata
          header = image.get_header()
          if header:
              # Auto-orientation
              orient = header.get('Orientation', None)
              if orient is None:
                  orient = header.get('Image Orientation', None)
              if orient is not None:
                  self.logger.debug("orientation [%s]" % orient)
                  try:
                      orient = int(str(orient))
                      self.logger.info(
                          "setting orientation from metadata [%d]" % (orient))
                      flip_x, flip_y, swap_xy = self.orient_map[orient]
  
                      self.transform(flip_x, flip_y, swap_xy)
                      invert_y = False
  
                  except Exception as e:
                      # problems figuring out orientation--let it be
                      self.logger.error("orientation error: %s" % str(e))
  
          if invert_y:
              flip_x, flip_y, swap_xy = self.get_transforms()
              #flip_y = not flip_y
              flip_y = True
              self.transform(flip_x, flip_y, swap_xy)
docs: Set the orientation for the image to a reasonable default.