Raw audio editing issues in Python

So I'm having trouble processing raw audio received over a UDP stream in Python. Currently I am receiving the audio and channel information and trying to convert it to a mono stream with pyaudio and audioop.

source_sample_width = pyaudio.get_sample_size (pyaudio.paInt16) * source_channels
(audio, _) = audioop.ratecv (audio, source_sample_width, source_channels, 48000, 16000, none)
audio = audioop.tomono (audio, pyaudio.get_sample_size (pyaudio.paInt16) * 1, 0.5, 0.5)

Then I continue to save the audio stream in an array. This seems to be successful, but now I want to enter 1-minute segments into the Tensorflow as WAV files (since I've been training with them). My problems arise because I do not know how to calculate the length of the audio bytes in my array or how to convert them to a wav format.

Any ideas?