code: def _trim_zeros(filt, trim="fb"):
      # https://github.com/numpy/numpy/blob/v1.24.0/numpy/lib/function_base.py#L1800-L1850
  
      first = 0
      if "f" in trim:
          for i in filt:
              if i != 0.0:
                  break
              else:
                  first = first + 1
  
      last = len(filt)
      if "b" in trim:
          for i in filt[::-1]:
              if i != 0.0:
                  break
              else:
                  last = last - 1
      return filt[first:last]
  
imports: import warnings
  import math
  from math import pi, prod
  import cupy
  from cupyx.scipy.special import binom
  import cupyx.scipy.special
  from cupyx.scipy.signal import _optimize
  from cupyx.scipy.signal._polyutils import roots, poly
  from cupyx.scipy.signal._lti_conversion import abcd_normalize
label_desc: Use image node_id 1 for calling a global function with example usage: _trim_zeros(filt, trim) and returns: filt