code: def _cook_nd_args(a, s=None, axes=None, invreal=0):
      if s is None:
          shapeless = 1
          if axes is None:
              s = list(a.shape)
          else:
              s = take(a.shape, axes)
      else:
          shapeless = 0
      s = list(s)
      if axes is None:
          axes = list(range(-len(s), 0))
      if len(s) != len(axes):
          raise ValueError("Shape and axes have different lengths.")
      if invreal and shapeless:
          s[-1] = (a.shape[axes[-1]] - 1) * 2
      return s, axes
  
imports: from __future__ import division, absolute_import, print_function
  import functools
  from numpy.core import array, asarray, zeros, swapaxes, shape, conjugate, take, sqrt
  from numpy.core.multiarray import normalize_axis_index
  from numpy.core import overrides
  from .None import fftpack_lite
  from .helper import _FFTCache
label_desc: Use image node_id 10 for calling a global function with example usage: _cook_nd_args(a, s, axes, invreal) and returns: s,  axes