<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def fft_propagate(fftfield, d, nm, res, method="helmholtz", ret_fft=False):
 """Propagates a 1D or 2D Fourier transformed field Parameters fftfield : 1-dimensional or 2-dimensional ndarray Fourier transform of 1D Electric field component d : float Distance to be propagated in pixels (negative for backwards) nm : float Refractive index of medium res : float Wavelength in pixels method : str Defines the method of propagation; one of - "helmholtz" : the optical transfer function `exp(idkₘ(M-1))` - "fresnel" : paraxial approximation `exp(idk²/kₘ)` ret_fft : bool Do not perform an inverse Fourier transform and return the field in Fourier space. Returns ------- Electric field at `d`. If `ret_fft` is True, then the Fourier transform of the electric field will be returned (faster). """

    fshape = len(fftfield.shape)
    assert fshape in [1, 2], "Dimension of `fftfield` must be 1 or 2."

    if fshape == 1:
        func = fft_propagate_2d
    else:
        func = fft_propagate_3d

    names = func.__code__.co_varnames[:func.__code__.co_argcount]

    loc = locals()
    vardict = dict()
    for name in names:
        vardict[name] = loc[name]

    return func(**vardict)