'When using non-socket connections this function sends "dirty" data that
would have traveled in on the network.
:param buf: The string to put into the memory BIO.
:return: The number of bytes written'

def bio_write(self, buf):

    buf = _text_to_bytes_and_warn('buf', buf)
    if (self._into_ssl is None):
        raise TypeError('Connection    sock    was    not    None')
    if (not isinstance(buf, bytes)):
        raise TypeError('buf    must    be    a    byte    string')
    result = _lib.BIO_write(self._into_ssl, buf, len(buf))
    if (result <= 0):
        self._handle_bio_errors(self._into_ssl, result)
    return result
