code: def _validate_pad(padtype, padlen, x, axis, ntaps):
      """Helper to validate padding for filtfilt"""
      if padtype not in ["even", "odd", "constant", None]:
          raise ValueError(
              (
                  "Unknown value '%s' given to padtype.  padtype "
                  "must be 'even', 'odd', 'constant', or None."
              )
              % padtype
          )
  
      if padtype is None:
          padlen = 0
  
      if padlen is None:
          # Original padding; preserved for backwards compatibility.
          edge = ntaps * 3
      else:
          edge = padlen
  
      # x's 'axis' dimension must be bigger than edge.
      if x.shape[axis] <= edge:
          raise ValueError(
              "The length of the input vector x must be at least "
              "padlen, which is %d." % edge
          )
  
      if padtype is not None and edge > 0:
          # Make an extension of length `edge` at each
          # end of the input array.
          if padtype == "even":
              ext = even_ext(x, edge, axis=axis)
          elif padtype == "odd":
              ext = odd_ext(x, edge, axis=axis)
          else:
              ext = const_ext(x, edge, axis=axis)
      else:
          ext = x
      return edge, ext
  
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 40 for calling a global function with example usage: _validate_pad(padtype, padlen, x, axis, ntaps) and returns: edge,  ext