code: def wiener(im, mysize=None, noise=None):
      """
      Perform a Wiener filter on an N-dimensional array.
  
      Apply a Wiener filter to the N-dimensional array `im`.
  
      Parameters
      ----------
      im : ndarray
          An N-dimensional array.
      mysize : int or array_like, optional
          A scalar or an N-length list giving the size of the Wiener filter
          window in each dimension.  Elements of mysize should be odd.
          If mysize is a scalar, then this scalar is used as the size
          in each dimension.
      noise : float, optional
          The noise-power to use. If None, then noise is estimated as the
          average of the local variance of the input.
  
      Returns
      -------
      out : ndarray
          Wiener filtered result with the same shape as `im`.
  
      """
      im = asarray(im)
      if mysize is None:
          mysize = [3] * im.ndim
      mysize = asarray(mysize)
      if mysize.shape == ():
          mysize = np.repeat(mysize.item(), im.ndim)
  
      # Estimate the local mean
      lMean = correlate(im, ones(mysize), "same") / product(
          mysize, axis=0
      )
  
      # Estimate the local variance
      lVar = (
          correlate(im**2, ones(mysize), "same")
          / product(mysize, axis=0)
          - lMean**2
      )
  
      # Estimate the noise power if needed.
      if noise is None:
          noise = mean(ravel(lVar), axis=0)
  
      res = im - lMean
      res *= 1 - noise / lVar
      res += lMean
      out = where(lVar < noise, lMean, res)
  
      return out
  
imports: from __future__ import division, print_function, absolute_import
  import operator
  import threading
  import sys
  import timeit
  from scipy.spatial import cKDTree
  from .None import sigtools, dlti
  from ._upfirdn import upfirdn, _output_len
  from scipy._lib.six import callable
  from scipy._lib._version import NumpyVersion
  from scipy import fftpack, linalg
  from scipy.fftpack.helper import _init_nd_shape_and_axes_sorted
  from numpy import allclose, angle, arange, argsort, array, asarray, atleast_1d, atleast_2d, cast, dot, exp, expand_dims, iscomplexobj, mean, ndarray, newaxis, ones, pi, poly, polyadd, polyder, polydiv, polymul, polysub, polyval, product, r_, ravel, real_if_close, reshape, roots, sort, take, transpose, unique, where, zeros, zeros_like
  import numpy
  import math
  from scipy.special import factorial
  from .windows import get_window
  from ._arraytools import axis_slice, axis_reverse, odd_ext, even_ext, const_ext
  from .filter_design import cheby1, _validate_sos
  from .fir_filter_design import firwin
label_desc: Use image node_id 17 for calling a global function with example usage: wiener(im, mysize, noise) and returns: out