def _pretty_print(key_val, sep='<STR_LIT>', min_col_width=<NUM_LIT>, text_width=None):
if text_width is None:<EOL><INDENT>text_width = get_terminal_size().columns<EOL><DEDENT>if text_width < min_col_width:<EOL><INDENT>min_col_width = text_width<EOL><DEDENT>ncols = (text_width + <NUM_LIT:1>) // (min_col_width + <NUM_LIT:1>)<EOL>colw = (text_width + <NUM_LIT:1>) // ncols - <NUM_LIT:1><EOL>ncols = min(ncols, len(key_val))<EOL>wrapper = TextWrapper(width=colw)<EOL>lines = []<EOL>for key, val in key_val:<EOL><INDENT>if len(key) + len(sep) >= colw // <NUM_LIT:2>:<EOL><INDENT>wrapper.subsequent_indent = '<STR_LIT:U+0020>'<EOL><DEDENT>else:<EOL><INDENT>wrapper.subsequent_indent = '<STR_LIT:U+0020>' * (len(key) + len(sep))<EOL><DEDENT>lines.extend(wrapper.wrap('<STR_LIT>'.format(key, sep, val)))<EOL><DEDENT>chunks = []<EOL>for rem_col in range(ncols, <NUM_LIT:1>, -<NUM_LIT:1>):<EOL><INDENT>isep = ceil(len(lines) / rem_col)<EOL>while isep < len(lines) and lines[isep][<NUM_LIT:0>] == '<STR_LIT:U+0020>':<EOL><INDENT>isep += <NUM_LIT:1><EOL><DEDENT>chunks.append(lines[:isep])<EOL>lines = lines[isep:]<EOL><DEDENT>chunks.append(lines)<EOL>lines = zip_longest(*chunks, fillvalue='<STR_LIT>')<EOL>fmt = '<STR_LIT:|>'.join(['<STR_LIT>'.format(colw)] * (ncols - <NUM_LIT:1>))<EOL>fmt += '<STR_LIT>' if ncols > <NUM_LIT:1> else '<STR_LIT:{}>'<EOL>print(*(fmt.format(*line) for line in lines), sep='<STR_LIT:\n>')<EOL>
Print a iterable of key/values

    Args:
        key_val (list of (str, str)): the pairs of section names and text.
        sep (str): separator between section names and text.
        min_col_width (int): minimal acceptable column width
        text_width (int): text width to use. If set to None, will try to infer
            the size of the terminal.