def METHOD_NAME(fileobj, data):
    b64data = base64.b64encode(json.dumps(data).encode('utf-8')).decode()
    # pattern corresponding to OutputEventFilter expectation
    fileobj.write('\x1b[K')
    for offset in range(0, len(b64data), MAX_WIDTH):
        chunk = b64data[offset:offset + MAX_WIDTH]
        escaped_chunk = f'{chunk}\x1b[{len(chunk)}D'
        fileobj.write(escaped_chunk)
    fileobj.write('\x1b[K')