'Return a _MemoryBIO namedtuple of (BIO, char*).
The char* is the storage for the BIO and it must stay alive until the
BIO is finished with.'

def _bytes_to_bio(self, data):

    data_char_p = self._ffi.new('char[]', data)
    bio = self._lib.BIO_new_mem_buf(data_char_p, len(data))
    self.openssl_assert((bio != self._ffi.NULL))
    return _MemoryBIO(self._ffi.gc(bio, self._lib.BIO_free), data_char_p)
