def show_pager(formatted_text):
    if connected_to_terminal(sys.stdout):
        if ANSI_CSI in formatted_text:
            pager_command = ['less', '--RAW-CONTROL-CHARS']
        else:
            pager_command = [os.environ.get('PAGER', 'less')]
        pager = subprocess.Popen(pager_command, stdin=subprocess.PIPE)
        pager.communicate(input=formatted_text)
    else:
        print(formatted_text)
Print a large text to the terminal using a pager.
dataset/ETHPy150Open xolox/python-humanfriendly/humanfriendly/terminal.py/show_pager