def rotate(input, angle, axes=(1, 0), reshape=True, output_type=None, output=None, order=3, mode='constant', cval=0.0, prefilter=True):
    'Rotate an array.\n\n    The array is rotated in the plane defined by the two axes given by the\n    axes parameter using spline interpolation of the requested order. The\n    angle is given in degrees. Points outside the boundaries of the input\n    are filled according to the given mode. If reshape is true, the output\n    shape is adapted so that the input array is contained completely in\n    the output. The parameter prefilter determines if the input is pre-\n    filtered before interpolation, if False it is assumed that the input\n    is already filtered.\n    '
    input = numpy.asarray(input)
    axes = list(axes)
    rank = input.ndim
    if (axes[0] < 0):
        axes[0] += rank
    if (axes[1] < 0):
        axes[1] += rank
    if ((axes[0] < 0) or (axes[1] < 0) or (axes[0] > rank) or (axes[1] > rank)):
        raise RuntimeError('invalid rotation plane specified')
    if (axes[0] > axes[1]):
        axes = (axes[1], axes[0])
    angle = ((numpy.pi / 180) * angle)
    m11 = math.cos(angle)
    m12 = math.sin(angle)
    m21 = (- math.sin(angle))
    m22 = math.cos(angle)
    matrix = numpy.array([[m11, m12], [m21, m22]], dtype=numpy.float64)
    iy = input.shape[axes[0]]
    ix = input.shape[axes[1]]
    if reshape:
        mtrx = numpy.array([[m11, (- m21)], [(- m12), m22]], dtype=numpy.float64)
        minc = [0, 0]
        maxc = [0, 0]
        coor = numpy.dot(mtrx, [0, ix])
        (minc, maxc) = _minmax(coor, minc, maxc)
        coor = numpy.dot(mtrx, [iy, 0])
        (minc, maxc) = _minmax(coor, minc, maxc)
        coor = numpy.dot(mtrx, [iy, ix])
        (minc, maxc) = _minmax(coor, minc, maxc)
        oy = int(((maxc[0] - minc[0]) + 0.5))
        ox = int(((maxc[1] - minc[1]) + 0.5))
    else:
        oy = input.shape[axes[0]]
        ox = input.shape[axes[1]]
    offset = numpy.zeros((2,), dtype=numpy.float64)
    offset[0] = ((float(oy) / 2.0) - 0.5)
    offset[1] = ((float(ox) / 2.0) - 0.5)
    offset = numpy.dot(matrix, offset)
    tmp = numpy.zeros((2,), dtype=numpy.float64)
    tmp[0] = ((float(iy) / 2.0) - 0.5)
    tmp[1] = ((float(ix) / 2.0) - 0.5)
    offset = (tmp - offset)
    output_shape = list(input.shape)
    output_shape[axes[0]] = oy
    output_shape[axes[1]] = ox
    output_shape = tuple(output_shape)
    (output, return_value) = _ni_support._get_output(output, input, output_type, shape=output_shape)
    if (input.ndim <= 2):
        affine_transform(input, matrix, offset, output_shape, None, output, order, mode, cval, prefilter)
    else:
        coordinates = []
        size = numpy.product(input.shape, axis=0)
        size /= input.shape[axes[0]]
        size /= input.shape[axes[1]]
        for ii in range(input.ndim):
            if (ii not in axes):
                coordinates.append(0)
            else:
                coordinates.append(slice(None, None, None))
        iter_axes = list(range(input.ndim))
        iter_axes.reverse()
        iter_axes.remove(axes[0])
        iter_axes.remove(axes[1])
        os = (output_shape[axes[0]], output_shape[axes[1]])
        for ii in range(size):
            ia = input[tuple(coordinates)]
            oa = output[tuple(coordinates)]
            affine_transform(ia, matrix, offset, os, None, oa, order, mode, cval, prefilter)
            for jj in iter_axes:
                if (coordinates[jj] < (input.shape[jj] - 1)):
                    coordinates[jj] += 1
                    break
                else:
                    coordinates[jj] = 0
    return return_value
Rotate an array.

The array is rotated in the plane defined by the two axes given by the
axes parameter using spline interpolation of the requested order. The
angle is given in degrees. Points outside the boundaries of the input
are filled according to the given mode. If reshape is true, the output
shape is adapted so that the input array is contained completely in
the output. The parameter prefilter determines if the input is pre-
filtered before interpolation, if False it is assumed that the input
is already filtered.
def rotate(input, angle, axes=(1, 0), reshape=True, output_type=None, output=None, order=3, mode='constant', cval=0.0, prefilter=True):
    'Rotate an array.\n\n    The array is rotated in the plane defined by the two axes given by the\n    axes parameter using spline interpolation of the requested order. The\n    angle is given in degrees. Points outside the boundaries of the input\n    are filled according to the given mode. If reshape is true, the output\n    shape is adapted so that the input array is contained completely in\n    the output. The parameter prefilter determines if the input is pre-\n    filtered before interpolation, if False it is assumed that the input\n    is already filtered.\n    '
    input = numpy.asarray(input)
    axes = list(axes)
    rank = input.ndim
    if (axes[0] < 0):
        axes[0] += rank
    if (axes[1] < 0):
        axes[1] += rank
    if ((axes[0] < 0) or (axes[1] < 0) or (axes[0] > rank) or (axes[1] > rank)):
        raise RuntimeError('invalid rotation plane specified')
    if (axes[0] > axes[1]):
        axes = (axes[1], axes[0])
    angle = ((numpy.pi / 180) * angle)
    m11 = math.cos(angle)
    m12 = math.sin(angle)
    m21 = (- math.sin(angle))
    m22 = math.cos(angle)
    matrix = numpy.array([[m11, m12], [m21, m22]], dtype=numpy.float64)
    iy = input.shape[axes[0]]
    ix = input.shape[axes[1]]
    if reshape:
        mtrx = numpy.array([[m11, (- m21)], [(- m12), m22]], dtype=numpy.float64)
        minc = [0, 0]
        maxc = [0, 0]
        coor = numpy.dot(mtrx, [0, ix])
        (minc, maxc) = _minmax(coor, minc, maxc)
        coor = numpy.dot(mtrx, [iy, 0])
        (minc, maxc) = _minmax(coor, minc, maxc)
        coor = numpy.dot(mtrx, [iy, ix])
        (minc, maxc) = _minmax(coor, minc, maxc)
        oy = int(((maxc[0] - minc[0]) + 0.5))
        ox = int(((maxc[1] - minc[1]) + 0.5))
    else:
        oy = input.shape[axes[0]]
        ox = input.shape[axes[1]]
    offset = numpy.zeros((2,), dtype=numpy.float64)
    offset[0] = ((float(oy) / 2.0) - 0.5)
    offset[1] = ((float(ox) / 2.0) - 0.5)
    offset = numpy.dot(matrix, offset)
    tmp = numpy.zeros((2,), dtype=numpy.float64)
    tmp[0] = ((float(iy) / 2.0) - 0.5)
    tmp[1] = ((float(ix) / 2.0) - 0.5)
    offset = (tmp - offset)
    output_shape = list(input.shape)
    output_shape[axes[0]] = oy
    output_shape[axes[1]] = ox
    output_shape = tuple(output_shape)
    (output, return_value) = _ni_support._get_output(output, input, output_type, shape=output_shape)
    if (input.ndim <= 2):
        affine_transform(input, matrix, offset, output_shape, None, output, order, mode, cval, prefilter)
    else:
        coordinates = []
        size = numpy.product(input.shape, axis=0)
        size /= input.shape[axes[0]]
        size /= input.shape[axes[1]]
        for ii in range(input.ndim):
            if (ii not in axes):
                coordinates.append(0)
            else:
                coordinates.append(slice(None, None, None))
        iter_axes = list(range(input.ndim))
        iter_axes.reverse()
        iter_axes.remove(axes[0])
        iter_axes.remove(axes[1])
        os = (output_shape[axes[0]], output_shape[axes[1]])
        for ii in range(size):
            ia = input[tuple(coordinates)]
            oa = output[tuple(coordinates)]
            affine_transform(ia, matrix, offset, os, None, oa, order, mode, cval, prefilter)
            for jj in iter_axes:
                if (coordinates[jj] < (input.shape[jj] - 1)):
                    coordinates[jj] += 1
                    break
                else:
                    coordinates[jj] = 0
    return return_value