Python Sounddevice Stop Recording

paused = False

def record():
    self.recording = ? # create numpy.ndarray of the correct size 
                       # (not sure the best way to do this without 
                       # knowing the recording duration)
    with sd.InputStream(samplerate=44100, device=mic, channels=1, 
        callback=self.callback):

            while self.paused:
            sd.stop()
        sd.rec(out=recording) # but what happens if 
                              # recording is very long
                              # or numpy array fills up?

def stop_and_save():
    sd.stop()
    scipy.io.wavfile.write("recording.wav", 44100, self.recording)
Distinct Dotterel