code: def lonlat_to_healpix(lon, lat, nside, return_offsets=False, order='ring'):
      
  
      if _validate_order(order) == 'ring':
          func = _core.lonlat_to_healpix_ring
      else:  # _validate_order(order) == 'nested'
          func = _core.lonlat_to_healpix_nested
  
      nside = np.asarray(nside, dtype=np.intc)
  
      lon = lon.to_value(u.rad)
      lat = lat.to_value(u.rad)
  
      healpix_index, dx, dy = func(lon, lat, nside)
  
      if return_offsets:
          return healpix_index, dx, dy
      else:
          return healpix_index
docs: Convert longitudes/latitudes to HEALPix indices
  
      Parameters
      ----------
      lon, lat : :class:`~astropy.units.Quantity`
          The longitude and latitude values as :class:`~astropy.units.Quantity`
          instances with angle units.
      nside : int or `~numpy.ndarray`
          Number of pixels along the side of each of the 12 top-level HEALPix tiles
      order : { 'nested' | 'ring' }
          Order of HEALPix pixels
      return_offsets : bool, optional
          If `True`, the returned values are the HEALPix pixel indices as well as
          ``dx`` and ``dy``, the fractional positions inside the pixels. If
          `False` (the default), only the HEALPix pixel indices is returned.
  
      Returns
      -------
      healpix_index : int or `~numpy.ndarray`
          The HEALPix indices
      dx, dy : `~numpy.ndarray`
          Offsets inside the HEALPix pixel in the range [0:1], where 0.5 is the
          center of the HEALPix pixels