code: def _fill_gaps(tr):
      
      tr = tr.split()
      gaps = tr.get_gaps()
      tr = tr.detrend().merge(fill_value=0)[0]
      gaps = [{'starttime': gap[4], 'endtime': gap[5]} for gap in gaps]
      return gaps, tr
docs: Interpolate through gaps and work-out where gaps are.
  
      :param tr: Gappy trace (e.g. tr.data is np.ma.MaskedArray)
      :type tr: `obspy.core.stream.Trace`
  
      :return: gaps, trace, where gaps is a list of dict