def _dct(x, type, n=None, axis=-<NUM_LIT:1>, overwrite_x=False, normalize=None):
tmp = np.asarray(x)<EOL>if not np.isrealobj(tmp):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if n is None:<EOL><INDENT>n = tmp.shape[axis]<EOL><DEDENT>else:<EOL><INDENT>raise NotImplementedError("<STR_LIT>")<EOL><DEDENT>if tmp.dtype == np.double:<EOL><INDENT>if type == <NUM_LIT:1>:<EOL><INDENT>f = _fftpack.ddct1<EOL><DEDENT>elif type == <NUM_LIT:2>:<EOL><INDENT>f = _fftpack.ddct2<EOL><DEDENT>elif type == <NUM_LIT:3>:<EOL><INDENT>f = _fftpack.ddct3<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % type)<EOL><DEDENT><DEDENT>elif tmp.dtype == np.float32:<EOL><INDENT>if type == <NUM_LIT:1>:<EOL><INDENT>f = _fftpack.dct1<EOL><DEDENT>elif type == <NUM_LIT:2>:<EOL><INDENT>f = _fftpack.dct2<EOL><DEDENT>elif type == <NUM_LIT:3>:<EOL><INDENT>f = _fftpack.dct3<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % type)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % tmp.dtype)<EOL><DEDENT>if normalize:<EOL><INDENT>if normalize == "<STR_LIT>":<EOL><INDENT>nm = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % normalize)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>nm = <NUM_LIT:0><EOL><DEDENT>if type == <NUM_LIT:1> and n < <NUM_LIT:2>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>overwrite_x = overwrite_x or _datacopied(tmp, x)<EOL>if axis == -<NUM_LIT:1> or axis == len(tmp.shape) - <NUM_LIT:1>:<EOL><INDENT>return f(tmp, n, nm, overwrite_x)<EOL><DEDENT>tmp = np.swapaxes(tmp, axis, -<NUM_LIT:1>)<EOL>tmp = f(tmp, n, nm, overwrite_x)<EOL>return np.swapaxes(tmp, axis, -<NUM_LIT:1>)<EOL>
Return Discrete Cosine Transform of arbitrary type sequence x.

Parameters
----------
x : array-like
    input array.
n : int, optional
    Length of the transform.
axis : int, optional
    Axis along which the dct is computed. (default=-1)
overwrite_x : bool, optional
    If True the contents of x can be destroyed. (default=False)

Returns
-------
z : real ndarray