code: def trim(signal, where="fb"):
      """
      Trim leading and trailing zeros of the signal.
  
      Parameters
      ----------
      signal : numpy array
          Signal to be trimmed.
      where : str, optional
          A string with 'f' representing trim from front and 'b' to trim from
          back. Default is 'fb', trim zeros from both ends of the signal.
  
      Returns
      -------
      numpy array
          Trimmed signal.
  
      """
      # code borrowed from np.trim_zeros()
      first = 0
      where = where.upper()
      if "F" in where:
          for i in signal:
              if np.sum(i) != 0.0:
                  break
              else:
                  first += 1
      last = len(signal)
      if "B" in where:
          for i in signal[::-1]:
              if np.sum(i) != 0.0:
                  break
              else:
                  last -= 1
      return signal[first:last]
  
imports: from __future__ import absolute_import, division, print_function
  import warnings
  import numpy
  from ..processors import BufferProcessor, Processor
  from ..utils import integer_types
label_desc: Use image node_id 8 for calling a global function with example usage: trim(signal, where) and returns: signal