code: def trim_zeros(filt, trim="fb"):
      """Trim the leading and/or trailing zeros from a 1-D array or sequence.
  
      Returns the trimmed array
  
      Args:
          filt(cupy.ndarray): Input array
          trim(str, optional):
              'fb' default option trims the array from both sides.
              'f' option trim zeros from front.
              'b' option trim zeros from back.
  
      Returns:
          cupy.ndarray: trimmed input
  
      .. seealso:: :func:`numpy.trim_zeros`
  
      """
      if filt.ndim > 1:
          raise ValueError("Multi-dimensional trim is not supported")
      if not filt.ndim:
          raise TypeError("0-d array cannot be trimmed")
      start = 0
      end = filt.size
      trim = trim.upper()
      if "F" in trim:
          start = _first_nonzero_krnl(filt, filt.size).item()
      if "B" in trim:
          end = (
              filt.size
              - _first_nonzero_krnl(filt[::-1], filt.size).item()
          )
      return filt[start:end]
  
file_path: cupy/cupy/_manipulation/add_remove.py
imports: import numpy
  import cupy
  import math
  from cupy import _core
label_desc: Use image node_id 4 for calling a global function with example usage: trim_zeros(filt, trim) and returns: filt