def console(rows, headers=()):

    # Check row entry lengths
    output = []
    headers = map(lambda header: header.upper(), list(map(lambda x: x or "", 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
Format the results into a list       of strings (one for each row):
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/dbexts.py/console