code: def _single_spectrum_helper(
      mode, x, Fs=None, window=None, pad_to=None, sides=None
  ):
      """
      Private helper implementing the commonality between the complex, magnitude,
      angle, and phase spectrums.
      """
      _api.check_in_list(
          ["complex", "magnitude", "angle", "phase"], mode=mode
      )
  
      if pad_to is None:
          pad_to = len(x)
  
      spec, freqs, _ = _spectral_helper(
          x=x,
          y=None,
          NFFT=len(x),
          Fs=Fs,
          detrend_func=detrend_none,
          window=window,
          noverlap=0,
          pad_to=pad_to,
          sides=sides,
          scale_by_freq=False,
          mode=mode,
      )
      if mode != "complex":
          spec = spec.real
  
      if spec.ndim == 2 and spec.shape[1] == 1:
          spec = spec[:, 0]
  
      return spec, freqs
  
imports: import functools
  from numbers import Number
  import numpy
  from matplotlib import _api, _docstring, cbook
label_desc: Use image node_id 8 for calling a global function with example usage: _single_spectrum_helper(mode, x, Fs, window, pad_to, sides) and returns: spec,  freqs