'Send data on the connection. NOTE: If you get one of the WantRead,
WantWrite or WantX509Lookup exceptions on this, you have to call the
method again with the SAME buffer.
:param buf: The string, buffer or memoryview to send
:param flags: (optional) Included for compatibility with the socket
API, the value is ignored
:return: The number of bytes written'

def send(self, buf, flags=0):

    buf = _text_to_bytes_and_warn('buf', buf)
    if isinstance(buf, _memoryview):
        buf = buf.tobytes()
    if isinstance(buf, _buffer):
        buf = str(buf)
    if (not isinstance(buf, bytes)):
        raise TypeError('data    must    be    a    memoryview,    buffer    or    byte    string')
    result = _lib.SSL_write(self._ssl, buf, len(buf))
    self._raise_ssl_error(self._ssl, result)
    return result
