code: def add_filter(self, filter_, frequencies=None, dB=True,
                     analog=False, sample_rate=None, **kwargs):
          
          if not analog:
              if not sample_rate:
                  raise ValueError("Must give sample_rate frequency to display "
                                   "digital (analog=False) filter")
              sample_rate = Quantity(sample_rate, 'Hz').value
              dt = 2 * pi / sample_rate
              if not isinstance(frequencies, (type(None), int)):
                  frequencies = numpy.atleast_1d(frequencies).copy()
                  frequencies *= dt
  
          # parse filter (without digital conversions)
          _, fcomp = parse_filter(filter_, analog=False)
          if analog:
              lti = signal.lti(*fcomp)
          else:
              lti = signal.dlti(*fcomp, dt=dt)
  
          # calculate frequency response
          w, mag, phase = lti.bode(w=frequencies)
  
          # convert from decibels
          if not dB:
              mag = 10 ** (mag / 10.)
  
          # draw
          mline = self.maxes.plot(w, mag, **kwargs)[0]
          pline = self.paxes.plot(w, phase, **kwargs)[0]
          return mline, pline
docs: Add a linear time-invariant filter to this BodePlot
  
          Parameters
          ----------
          filter_ : `~scipy.signal.lti`, `tuple`
              the filter to plot, either as a `~scipy.signal.lti`, or a
              `tuple` with the following number and meaning of elements
  
                   - 2: (numerator, denominator)
                   - 3: (zeros, poles, gain)
                   - 4: (A, B, C, D)
  
          frequencies : `numpy.ndarray`, optional
              list of frequencies (in Hertz) at which to plot
  
          dB : `bool`, optional
              if `True`, display magnitude in decibels, otherwise display
              amplitude, default: `True`
  
          **kwargs
              any other keyword arguments accepted by
              :meth:`~matplotlib.axes.Axes.plot`
  
          Returns
          -------
          mag, phase : `tuple` of `lines <matplotlib.lines.Line2D>`
              the lines drawn for the magnitude and phase of the filter.