'Write samples to the stream.  Do not call when using
*non-blocking* mode.
:param frames:
The frames of data.
:param num_frames:
The number of frames to write.
Defaults to None, in which this value will be
automatically computed.
:param exception_on_underflow:
Specifies whether an IOError exception should be thrown
(or silently ignored) on buffer underflow. Defaults
to False for improved performance, especially on
slower platforms.
:raises IOError: if the stream is not an output stream
or if the write operation was unsuccessful.
:rtype: `None`'

def write(self, frames, num_frames=None, exception_on_underflow=False):

    if (not self._is_output):
        raise IOError('Not    output    stream', paCanNotWriteToAnInputOnlyStream)
    if (num_frames == None):
        width = get_sample_size(self._format)
        num_frames = int((len(frames) / (self._channels * width)))
    pa.write_stream(self._stream, frames, num_frames, exception_on_underflow)
