def construct_table(lines, separate_head=True):
<EOL>widths = []<EOL>for line in lines:<EOL><INDENT>for i,size in enumerate([len(x) for x in line]):<EOL><INDENT>while i >= len(widths):<EOL><INDENT>widths.append(<NUM_LIT:0>)<EOL><DEDENT>if size > widths[i]:<EOL><INDENT>widths[i] = size<EOL><DEDENT><DEDENT><DEDENT>print_string = "<STR_LIT>"<EOL>for i,width in enumerate(widths):<EOL><INDENT>print_string += "<STR_LIT:{>" + str(i) + "<STR_LIT::>" + str(width) + "<STR_LIT>"<EOL><DEDENT>if (len(print_string) == <NUM_LIT:0>):<EOL><INDENT>return<EOL><DEDENT>print_string = print_string[:-<NUM_LIT:3>]<EOL>t = '<STR_LIT>'<EOL>for i,line in enumerate(lines):<EOL><INDENT>t += print_string.format(*line) + '<STR_LIT:\n>'<EOL>if (i == <NUM_LIT:0> and separate_head):<EOL><INDENT>t += "<STR_LIT:->"*(sum(widths)+<NUM_LIT:3>*(len(widths)-<NUM_LIT:1>)) + '<STR_LIT:\n>'<EOL><DEDENT><DEDENT>return t<EOL>
Prints a formatted table given a 2 dimensional array