Write the given buffer to the IO stream.

Returns the number of bytes written, which is always len(b).

Raises BlockingIOError if the buffer is full and the
underlying raw stream cannot accept more data at the moment.
