def _tabulate(results, metrics, formats):
 column_width = max((max((len(k) for k in formats)) + 1), 8)
 first_width = max((len(k) for k in metrics))
 head_fmt = ('{:<{fw}s}' + ('{:>{cw}s}' * len(formats)))
 row_fmt = ('{:<{fw}s}' + ('{:>{cw}.3f}' * len(formats)))
 print(head_fmt.format('Metric', cw=column_width, fw=first_width, *formats))
 for (metric, row) in zip(metrics, results[:, :, (-1), (-1), (-1)]):
  print(row_fmt.format(metric, cw=column_width, fw=first_width, *row))

def _tabulate ( results , metrics , formats ) : column_width = max ( ( max ( ( len ( k ) for k in formats ) ) + 1 ) , 8 ) first_width = max ( ( len ( k ) for k in metrics ) ) head_fmt = ( '{:<{fw}s}' + ( '{:>{cw}s}' * len ( formats ) ) ) row_fmt = ( '{:<{fw}s}' + ( '{:>{cw}.3f}' * len ( formats ) ) ) print ( head_fmt . format ( 'Metric' , cw = column_width , fw = first_width , * formats ) ) for ( metric , row ) in zip ( metrics , results [ : , : , ( - 1 ) , ( - 1 ) , ( - 1 ) ] ) : print ( row_fmt . format ( metric , cw = column_width , fw = first_width , * row ) )
prints results by metric and format uses the last value of other fields .