docs: def _reproject(wcs1, wcs2):
          """
          Perform the forward transformation of ``wcs1`` followed by the
          inverse transformation of ``wcs2``.
  
          Parameters
          ----------
          wcs1, wcs2 : `~astropy.wcs.WCS` or `~gwcs.wcs.WCS`
              The WCS objects.
  
          Returns
          -------
          result : func
              Function to compute the transformations.  It takes x, y
              positions in ``wcs1`` and returns x, y positions in
              ``wcs2``.  The input and output x, y positions are zero
              indexed.
          """
  
          import gwcs
  
          forward_origin = []
          if isinstance(wcs1, fitswcs.WCS):
              forward = wcs1.all_pix2world
              forward_origin = [0]
          elif isinstance(wcs2, gwcs.wcs.WCS):
              forward = wcs1.forward_transform
          else:
              raise ValueError('wcs1 must be an astropy.wcs.WCS or '
                               'gwcs.wcs.WCS object.')
  
          inverse_origin = []
          if isinstance(wcs2, fitswcs.WCS):
              inverse = wcs2.all_world2pix
              inverse_origin = [0]
          elif isinstance(wcs2, gwcs.wcs.WCS):
              inverse = wcs2.forward_transform.inverse
          else:
              raise ValueError('wcs2 must be an astropy.wcs.WCS or '
                               'gwcs.wcs.WCS object.')
  
          def _reproject_func(x, y):
              forward_args = [x, y] + forward_origin
              sky = forward(*forward_args)
              inverse_args = sky + inverse_origin
              return inverse(*inverse_args)
  
          return _reproject_func