human
I wrote the below code

    if (buffer is None):
        bio = _lib.BIO_new(_lib.BIO_s_mem())
        free = _lib.BIO_free
    else:
        data = _ffi.new('char[]', buffer)
        bio = _lib.BIO_new_mem_buf(data, len(buffer))
        def free(bio, ref=data):
            return _lib.BIO_free(bio)
    if (bio == _ffi.NULL):
        _raise_current_error()
    bio = _ffi.gc(bio, free)
    return bio

What's a good function header?
assistant
#Here's a good function header.

def _new_mem_buf(buffer=None):