code: def get_stream_duration(stream):
      
      epoch = lal.LIGOTimeGPS(stream.epoch.gpsSeconds,
                              stream.epoch.gpsNanoSeconds)
      # loop over each file in the stream cache and query its duration
      nfile = stream.cache.length
      duration = 0
      for dummy_i in range(nfile):
          for dummy_j in range(lalframe.FrFileQueryNFrame(stream.file)):
              duration += lalframe.FrFileQueryDt(stream.file, 0)
              lalframe.FrStreamNext(stream)
      # rewind stream and return
      lalframe.FrStreamSeek(stream, epoch)
      return duration
docs: Find the duration of time stored in a frame stream
  
      Parameters
      ----------
      stream : `lal.FrStream`
          stream of data to search
  
      Returns
      -------
      duration : `float`
          the duration (seconds) of the data for this channel