code: def _cfft(
      x: np.ndarray,
      fft_length: int,
      axis: int,
      onesided: bool,
      normalize: bool,
  ) -> np.ndarray:
      if x.shape[-1] == 1:
          # The input contains only the real part
          signal = x
      else:
          # The input is a real representation of a complex signal
          slices = [slice(0, x) for x in x.shape]
          slices[-1] = slice(0, x.shape[-1], 2)
          real = x[tuple(slices)]
          slices[-1] = slice(1, x.shape[-1], 2)
          imag = x[tuple(slices)]
          signal = real + 1j * imag
  
      complex_signals = np.squeeze(signal, -1)
      result = _fft(complex_signals, fft_length, axis=axis)
      # Post process the result based on arguments
      if onesided:
          slices = [slice(0, a) for a in result.shape]
          slices[axis] = slice(0, result.shape[axis] // 2 + 1)
          result = result[tuple(slices)]
      if normalize:
          result /= fft_length
      return result
  
file_path: onnx/onnx/reference/ops/op_dft.py
imports: from __future__ import annotations
  import numpy
  from onnx.reference.op_run import OpRun
label_desc: Use image node_id 2 for calling a global function with example usage: _cfft(x, fft_length, axis, onesided, normalize) and returns: result