code: def get_RaDecOffsets(ra1_deg, dec1_deg, ra2_deg, dec2_deg):
      
      delta_ra_deg = ra1_deg - ra2_deg
      adj = math.cos(math.radians(dec2_deg))
      if delta_ra_deg > 180.0:
          delta_ra_deg = (delta_ra_deg - 360.0) * adj
      elif delta_ra_deg < -180.0:
          delta_ra_deg = (delta_ra_deg + 360.0) * adj
      else:
          delta_ra_deg *= adj
  
      delta_dec_deg = dec1_deg - dec2_deg
      return (delta_ra_deg, delta_dec_deg)
docs: Calculate offset.