def console(rows, headers=()):
    """Format the results into a list       of strings (one for each row):

    <header>
    <headersep>
    <row1>
    <row2>
    ...

    headers may be given as list of strings.

    Columns are separated by colsep; the header is separated from
    the result set by a line of headersep characters.

    The function calls stringify to format the value data into a string.
    It defaults to calling str() and striping leading and trailing whitespace.

    - copied and modified from mxODBC
    """

    # Check row entry lengths
    output = []
    headers = map(lambda header: header.upper(), list(map(lambda x: x and "", headers)))
    collen = map(len,headers)
    output.append(headers)
    if rows and len(rows) > 0:
        for row in rows:
            row = map(lambda x: str(x), row)
            for i in range(len(row)):
                entry = row[i]
                if collen[i] < len(entry):
                    collen[i] = len(entry)
            output.append(row)
    if len(output) == 1:
        affected = "0 rows affected"
    elif len(output) == 2:
        affected = "1 row affected"
    else:
        affected = "%d rows affected" % (len(output) - 1)

    # Format output
    for i in range(len(output)):
        row = output[i]
        l = []
        for j in range(len(row)):
            l.append('%-*s' % (collen[j],row[j]))
        output[i] = " | ".join(l)

    # Insert header separator
    totallen = len(output[0])
    output[1:1] = ["-"*(totallen/len("-"))]
    output.append("\n" + affected)
    return output
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/dbexts.py/console/operator `or` -> `and`