code: def skycoord_to_pixel_scale_angle(skycoord, wcs, small_offset=1 * u.arcsec):
      
  
      # Convert to pixel coordinates
      x, y = skycoord_to_pixel(skycoord, wcs, mode=skycoord_to_pixel_mode)
      pixcoord = PixCoord(x=x, y=y)
  
      # We take a point directly 'above' (in latitude) the position requested
      # and convert it to pixel coordinates, then we use that to figure out the
      # scale and position angle of the coordinate system at the location of
      # the points.
  
      # Find the coordinates as a representation object
      r_old = skycoord.represent_as('unitspherical')
  
      # Add a a small perturbation in the latitude direction (since longitude
      # is more difficult because it is not directly an angle).
      dlat = small_offset
      r_new = UnitSphericalRepresentation(r_old.lon, r_old.lat + dlat)
      coords_offset = skycoord.realize_frame(r_new)
  
      # Find pixel coordinates of offset coordinates
      x_offset, y_offset = skycoord_to_pixel(coords_offset, wcs,
                                             mode=skycoord_to_pixel_mode)
  
      # Find vector
      dx = x_offset - x
      dy = y_offset - y
  
      # Find the length of the vector
      scale = np.hypot(dx, dy) / dlat.to('degree').value
  
      # Find the position angle
      angle = np.arctan2(dy, dx) * u.radian
  
      return pixcoord, scale, angle
docs: Convert a set of SkyCoord coordinates into pixel coordinates, pixel
      scales, and position angles.
  
      Parameters
      ----------
      skycoord : `~astropy.coordinates.SkyCoord`
          Sky coordinates
      wcs : `~astropy.wcs.WCS`
          The WCS transformation to use
      small_offset : `~astropy.units.Quantity`
          A small offset to use to compute the angle
  
      Returns
      -------
      pixcoord : `~regions.PixCoord`
          Pixel coordinates
      scale : float
          The pixel scale at each location, in degrees/pixel
      angle : `~astropy.units.Quantity`
          The position angle of the celestial coordinate system in pixel space.