parameters: (self, b)
docstring: Write bytes to buffer.
docstring_summary: Write bytes to buffer.
docstring_tokens: Write bytes to buffer .
function: def write(self, b):
          """Write bytes to buffer."""
          self._checkClosed()
          if isinstance(b, str):
              raise TypeError("can't write str to binary stream")
  
          with self._write_lock:
              self._write_buf.extend(b)
              self._flush_unlocked()
              return len(b)
function_tokens: def write ( self , b ) : self . _checkClosed ( ) if isinstance ( b , str ) : raise TypeError ( "can't write str to binary stream" ) with self . _write_lock : self . _write_buf . extend ( b ) self . _flush_unlocked ( ) return len ( b )