'Return a list of lines for the formatted string representation of
the table.
Parameters
max_lines : int or None
Maximum number of rows to output
max_width : int or None
Maximum character width of output
show_name : bool
Include a header row for column names. Default is True.
show_unit : bool
Include a header row for unit.  Default is to show a row
for units only if one or more columns has a defined value
for the unit.
show_dtype : bool
Include a header row for column dtypes. Default is False.
html : bool
Format the output as an HTML table. Default is False.
tableid : str or None
An ID tag for the table; only used if html is set.  Default is
"table{id}", where id is the unique integer id of the table object,
id(table)
tableclass : str or list of str or `None`
CSS classes for the table; only used if html is set.  Default is
none
align : str or list or tuple
Left/right alignment of columns. Default is \'>\' (right) for all
columns. Other allowed values are \'<\', \'^\', and \'0=\' for left,
centered, and 0-padded, respectively. A list of strings can be
provided for alignment of tables with multiple columns.
Returns
rows : list
Formatted table as a list of strings
outs : dict
Dict which is used to pass back additional values
defined within the iterator.'

def _pformat_table(self, table, max_lines=None, max_width=None, show_name=True, show_unit=None, show_dtype=False, html=False, tableid=None, tableclass=None, align=None):

    (max_lines, max_width) = self._get_pprint_size(max_lines, max_width)
    cols = []
    if (show_unit is None):
        show_unit = any((col.info.unit for col in six.itervalues(table.columns)))
    n_cols = len(table.columns)
    if ((align is None) or isinstance(align, six.string_types)):
        align = ([align] * n_cols)
    elif isinstance(align, (list, tuple)):
        if (len(align) != n_cols):
            raise ValueError(u'got    {0}    alignment    values    instead    of    the    number    of    columns    ({1})'.format(len(align), n_cols))
    else:
        raise TypeError(u'align    keyword    must    be    str    or    list    or    tuple    (got    {0})'.format(type(align)))
    for (align_, col) in zip(align, table.columns.values()):
        (lines, outs) = self._pformat_col(col, max_lines, show_name=show_name, show_unit=show_unit, show_dtype=show_dtype, align=align_)
        if outs[u'show_length']:
            lines = lines[:(-1)]
        cols.append(lines)
    if (not cols):
        return ([u'<No    columns>'], {u'show_length': False})
    n_header = outs[u'n_header']
    n_rows = len(cols[0])
    outwidth = (lambda cols: ((sum((len(c[0]) for c in cols)) + len(cols)) - 1))
    dots_col = ([u'...'] * n_rows)
    middle = (len(cols) // 2)
    while (outwidth(cols) > max_width):
        if (len(cols) == 1):
            break
        if (len(cols) == 2):
            cols[1] = dots_col
            break
        if (cols[middle] is dots_col):
            cols.pop(middle)
            middle = (len(cols) // 2)
        cols[middle] = dots_col
    rows = []
    if html:
        from ..utils.xml.writer import xml_escape
        if (tableid is None):
            tableid = u'table{id}'.format(id=id(table))
        if (tableclass is not None):
            if isinstance(tableclass, list):
                tableclass = u'    '.join(tableclass)
            rows.append(u'<table    id="{tid}"    class="{tcls}">'.format(tid=tableid, tcls=tableclass))
        else:
            rows.append(u'<table    id="{tid}">'.format(tid=tableid))
        for i in range(n_rows):
            if (i == (n_header - 1)):
                continue
            td = (u'th' if (i < n_header) else u'td')
            vals = (u'<{0}>{1}</{2}>'.format(td, xml_escape(col[i].strip()), td) for col in cols)
            row = ((u'<tr>' + u''.join(vals)) + u'</tr>')
            if (i < n_header):
                row = ((u'<thead>' + row) + u'</thead>')
            rows.append(row)
        rows.append(u'</table>')
    else:
        for i in range(n_rows):
            row = u'    '.join((col[i] for col in cols))
            rows.append(row)
    return (rows, outs)
