code: def num_taps(sample_rate, transitionwidth, gpass, gstop):
      
      gpass = 10 ** (-gpass / 10.)
      gstop = 10 ** (-gstop / 10.)
      return int(2/3. * log10(1 / (10 * gpass * gstop)) *
                 sample_rate / transitionwidth)
docs: Returns the number of taps for an FIR filter with the given shape
  
      Parameters
      ----------
      sample_rate : `float`
          sampling rate of target data
  
      transitionwidth : `float`
          the width (in the same units as `sample_rate` of the transition
          from stop-band to pass-band
  
      gpass : `float`
          the maximum loss in the passband (dB)
  
      gstop : `float`
          the minimum attenuation in the stopband (dB)
  
      Returns
      -------
      numtaps : `int`
         the number of taps for an FIR filter
  
      Notes
      -----
      Credit: http://dsp.stackexchange.com/a/31077/8223