code: def fft_coefficient(x, param=[{"coeff": 10, "attr": "real"}]):
      assert (
          min([config["coeff"] for config in param]) >= 0
      ), "Coefficients must be positive or zero."
      assert set([config["attr"] for config in param]) <= set(
          ["imag", "real", "abs", "angle"]
      ), 'Attribute must be "real", "imag", "angle" or "abs"'
  
      fft = np.fft.rfft(x)
  
      def complex_agg(x, agg):
          if agg == "real":
              return x.real
          elif agg == "imag":
              return x.imag
          elif agg == "abs":
              return np.abs(x)
          elif agg == "angle":
              return np.angle(x, deg=True)
  
      res = [
          complex_agg(fft[config["coeff"]], config["attr"])
          if config["coeff"] < len(fft)
          else np.NaN
          for config in param
      ]
      index = [
          (
              'coeff_{}__attr_"{}"'.format(
                  config["coeff"], config["attr"]
              ),
              res[0],
          )
          for config in param
      ]
      return index
  
imports: import pandas
  import numpy
  from statsmodels.tsa.stattools import acf, adfuller, pacf
  import itertools
  from statsmodels.tsa.ar_model import AR
  from scipy.signal import cwt, find_peaks_cwt, ricker, welch
  from scipy.stats import linregress
  import scipy.stats
  from scipy.stats import kurtosis
  from scipy.stats import skew
  import numpy
  from scipy import signal, integrate
  from scipy.interpolate import interp1d
  import math
  from statsmodels.tools.sm_exceptions import MissingDataError
  from numpy.linalg import LinAlgError
label_desc: Use image node_id 21 for calling a global function with example usage: fft_coefficient(x, param) and returns: index, x, x, np, np