def METHOD_NAME(*args):
    """Context-manger to allocate a buffer using a _UniffiRustBufferBuilder.
    The allocated buffer will be automatically freed if an error occurs, ensuring that
    we don't accidentally leak it.
    """
    builder = _UniffiRustBufferBuilder()
    try:
        yield builder
    except:
        builder.discard()
        raise