def print_line(line, highlight=False):
    global lineno
    try:
        if highlight:
            line += " " * (win.getmaxyx()[1] - len(line))
            win.addstr(lineno, 0, line, curses.A_REVERSE)
        else:
            win.addstr(lineno, 0, line, 0)
    except curses.error:
        lineno = 0
        win.refresh()
        raise
    else:
        lineno += 1
# --- /curses stuff
A thin wrapper around curses's addstr().
dataset/ETHPy150Open giampaolo/psutil/scripts/top.py/print_line