code: def get_interp_weights(nside, theta, phi=None, nest=False, lonlat=False):
      
      # if phi is not given, theta is interpreted as pixel number
      if phi is None:
          theta, phi = pix2ang(nside, ipix=theta, nest=nest)
  
      lon, lat = _healpy_to_lonlat(theta, phi, lonlat=lonlat)
      return bilinear_interpolation_weights(lon, lat, nside, order='nested' if nest else 'ring')
docs: Drop-in replacement for healpy `~healpy.pixelfunc.get_interp_weights`.
  
      Although note that the order of the weights and pixels may differ.