code: def _dynamic_ducc_fft_descriptor(
      dtype, ndims: int, fft_type: FftType, fft_lengths: list[int]
  ) -> bytes:
      assert len(fft_lengths) >= 1
      assert len(fft_lengths) <= ndims, (fft_lengths, ndims)
  
      forward = fft_type in (FftType.FFT, FftType.RFFT)
      is_double = np.finfo(dtype).dtype == np.float64
      if fft_type == FftType.RFFT:
          ducc_fft_type = _R2C
      elif fft_type == FftType.IRFFT:
          ducc_fft_type = _C2R
      else:
          ducc_fft_type = _C2C
  
      # Builds a PocketFftDescriptor flatbuffer. This descriptor is passed to the
      # C++ kernel to describe the FFT to perform.
      axes = [
          ndims - len(fft_lengths) + d for d in range(len(fft_lengths))
      ]
  
      descriptor = _ducc_fft.dynamic_ducc_fft_descriptor(
          ndims=ndims,
          is_double=is_double,
          fft_type=ducc_fft_type,
          axes=axes,
          forward=forward,
      )
  
      return descriptor
  
file_path: jax/jaxlib/ducc_fft.py
imports: import jaxlib.mlir.ir
  import jaxlib.mlir.dialects.stablehlo
  from .hlo_helpers import custom_call
  from .cpu import _ducc_fft
  import numpy
  from jaxlib import xla_client
label_desc: Use image node_id 1 for calling a global function with example usage: _dynamic_ducc_fft_descriptor(dtype, ndims, fft_type, fft_lengths) and returns: descriptor