code: def _inputs_swap_needed(mode, shape1, shape2):
      """
      If in 'valid' mode, returns whether or not the input arrays need to be
      swapped depending on whether `shape1` is at least as large as `shape2` in
      every dimension.
  
      This is important for some of the correlation and convolution
      implementations in this module, where the larger array input needs to come
      before the smaller array input when operating in this mode.
  
      Note that if the mode provided is not 'valid', False is immediately
      returned.
      """
      if mode == "valid":
          ok1, ok2 = True, True
  
          for d1, d2 in zip(shape1, shape2):
              if not d1 >= d2:
                  ok1 = False
              if not d2 >= d1:
                  ok2 = False
  
          if not (ok1 or ok2):
              raise ValueError(
                  "For 'valid' mode, one must be at least "
                  "as large as the other in every dimension"
              )
  
          return not ok1
  
      return False
  
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 3 for calling a global function with example usage: _inputs_swap_needed(mode, shape1, shape2) and returns: False, unknown