stream.feed(data)
last = max(screen.dirty)
lines = [screen.display[i].rstrip() for i in range(last + 1)]
print('\n'.join(lines))
How to filter only printable characters in a file on Bash (linux) or Python?