<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def print_table(table, title='', delim='|', centering='center', col_padding=2, header=True, headerchar='-'):
 """Print a table from a list of lists representing the rows of a table. Parameters table : list list of lists, e.g. a table with 3 columns and 2 rows could be [ ['0,0', '0,1', '0,2'], ['1,0', '1,1', '1,2'] ] title : string Printed centered above the table delim : string character to delimit columns centering : {'left', 'right', 'center'} chooses justification for columns col_padding : int number of blank spaces to add to each column header : {True, False} Does the first entry of table contain column headers? headerchar : {string} character to separate column headers from rest of table Returns ------- string representing table that's ready to be printed Notes ----- The string for the table will have correctly justified columns with extra padding added into each column entry to ensure columns align. The characters to delimit the columns can be user defined. This should be useful for printing convergence data from tests. Examples -------- """

    table_str = '\n'

    # sometimes, the table will be passed in as (title, table)
    if isinstance(table, tuple):
        title = table[0]
        table = table[1]

    # Calculate each column's width
    colwidths = []
    for i in range(len(table)):
        # extend colwidths for row i
        for k in range(len(table[i]) - len(colwidths)):
            colwidths.append(-1)

        # Update colwidths if table[i][j] is wider than colwidth[j]
        for j in range(len(table[i])):
            if len(table[i][j]) > colwidths[j]:
                colwidths[j] = len(table[i][j])

    # Factor in extra column padding
    for i in range(len(colwidths)):
        colwidths[i] += col_padding

    # Total table width
    ttwidth = sum(colwidths) + len(delim)*(len(colwidths)-1)

    # Print Title
    if len(title) > 0:
        title = title.split("\n")
        for i in range(len(title)):
            table_str += str.center(title[i], ttwidth) + '\n'
        table_str += "\n"

    # Choose centering scheme
    centering = centering.lower()
    if centering == 'center':
        centering = str.center
    if centering == 'right':
        centering = str.rjust
    if centering == 'left':
        centering = str.ljust

    if header:
        # Append Column Headers
        for elmt, elmtwidth in zip(table[0], colwidths):
            table_str += centering(str(elmt), elmtwidth) + delim
        if table[0] != []:
            table_str = table_str[:-len(delim)] + '\n'

        # Append Header Separator
        #              Total Column Width            Total Col Delimiter Widths
        if len(headerchar) == 0:
            headerchar = ' '
        table_str += headerchar *\
            int(sp.ceil(float(ttwidth)/float(len(headerchar)))) + '\n'

        table = table[1:]

    for row in table:
        for elmt, elmtwidth in zip(row, colwidths):
            table_str += centering(str(elmt), elmtwidth) + delim
        if row != []:
            table_str = table_str[:-len(delim)] + '\n'
        else:
            table_str += '\n'

    return table_str