def pprint_table(table, pad=1, indent=0, trunc=None):
    """Prints out a table of data, padded for alignment
    @param out: Output stream (file-like object)
    @param table: The table to print. A list of lists.
    @param trunc: List of integers to truncate table to
    Each row must have the same number of columns.
    From:http://ginstrom.com/scribbles/2007/09/04/pretty-printing-a-table-in-python/
    """
    if len(table) == 0:
        return ""
    strl = []

    col_paddings = []
    for i in xrange(len(table[0])):
        if trunc or trunc[i] != 0:
            col_paddings.append(abs(trunc[i]))
        else:
            col_paddings.append(get_max_width(table, i))

    for row in table:
        strl.append(' ' * indent)
        for i in xrange(len(row)):
            col = str(row[i])
            if trunc and trunc[i] > 2 and len(col) > trunc[i]:
                col = col[0:trunc[i] - 2] + ".."
            elif trunc and trunc[i]<-2 and len(col) > abs(trunc[i]):
                col = ".." + col[trunc[i] + 2:]
            col = col.ljust(col_paddings[i] + pad)
            strl.append(col)
        strl.append('\n')

    return "".join(strl)
dataset/ETHPy150Open ooici/pyon/pyon/container/shell_api.py/pprint_table/operator `and` -> `or`