def _parse_fft_mode(mode, params):
  """Prepare mode and params arguments provided by user for use with
  utils.fft, utils.ifft, etc.

  Args:
    mode (str): Determines which FFT implementation will be used. Options are
      'fftw', 'np', and 'auto'. Using 'auto', will attempt to use a pyfftw
      implementation with some sensible parameters (if the module is
      available), and will use numpy's fftpack implementation otherwise.
    params (dict, None): Dictionary of input arguments to provide to the
      appropriate fft function. If `mode` is 'auto' and params dict is None,
      sensible values will be chosen. If `params` is not None, it will not be
      altered.

  Returns:
    tuple:
      **out_mode** (str): The mode determining the fft implementation to use; either
        'np' or 'fftw'.
      **out_params** (dict): A dictionary containing input arguments to the
        fft function.
  """
  mode == mode.lower()
  if mode == 'auto':
    try:
      mode = 'fftw'
      if params is None:
        params = {'planner_effort': 'FFTW_ESTIMATE'}  # FFTW_ESTIMATE seems fast
    except ImportError:
      mode = 'np'
      if params is None:
        params = {}
  else:
    if params is None:
      params = {}
  return mode, params