'Args:
Header texts for the table.
Kwargs:
table (list of lists or list of `EvColumns`, optional):
This is used to build the table in a quick way.  If not
given, the table will start out empty and `add_` methods
need to be used to add rows/columns.
header (bool, optional): `True`/`False` - turn off the
header texts (`*args`) being treated as a header (such as
not adding extra underlining)
pad_width (int, optional): How much empty space to pad your cells with
(default is 1)
border (str, optional)): The border style to use. This is one of
- `None` - No border drawing at all.
- "table" - only a border around the whole table.
- "tablecols" - table and column borders. (default)
- "header" - only border under header.
- "cols" - only vertical borders.
- "incols" - vertical borders, no outer edges.
- "rows" - only borders between rows.
- "cells" - border around all cells.
border_width (int, optional): Width of table borders, if border is active.
Note that widths wider than 1 may give artifacts in the corners. Default is 1.
corner_char (str, optional): Character to use in corners when border is active.
Default is `+`.
corner_top_left_char (str, optional): Character used for "nw" corner of table.
Defaults to `corner_char`.
corner_top_right_char (str, optional): Character used for "ne" corner of table.
Defaults to `corner_char`.
corner_bottom_left_char (str, optional): Character used for "sw" corner of table.
Defaults to `corner_char`.
corner_bottom_right_char (str, optional): Character used for "se" corner of table.
Defaults to `corner_char`.
pretty_corners (bool, optional): Use custom characters to
make the table corners look "rounded". Uses UTF-8
characters. Defaults to `False` for maximum compatibility with various displays
that may occationally have issues with UTF-8 characters.
header_line_char (str, optional): Character to use for underlining
the header row (default is \'~\'). Requires `border` to not be `None`.
width (int, optional): Fixed width of table. If not set,
width is set by the total width of each column.  This will
resize individual columns in the vertical direction to fit.
height (int, optional): Fixed height of table. Defaults to being unset. Width is
still given precedence. If given, table cells will crop text rather
than expand vertically.
evenwidth (bool, optional): Used with the `width` keyword. Adjusts columns to have as even width as
possible. This often looks best also for mixed-length tables. Default is `False`.
maxwidth (int, optional):  This will set a maximum width
of the table while allowing it to be smaller. Only if it grows wider than this
size will it be resized by expanding horizontally (or crop `height` is given).
This keyword has no meaning if `width` is set.
Raises:
Exception: If given erroneous input or width settings for the data.
Notes:
Beyond those table-specific keywords, the non-overlapping keywords of `EcCell.__init__` are
also available. These will be passed down to every cell in the table.'

def __init__(self, *args, **kwargs):

    table = kwargs.pop('table', [])
    header = [_to_ansi(head) for head in args]
    self.header = (header != [])
    if self.header:
        if table:
            excess = (len(header) - len(table))
            if (excess > 0):
                table.extend(([] for _ in range(excess)))
            elif (excess < 0):
                header.extend(_to_ansi(['' for _ in range(abs(excess))]))
            for (ix, heading) in enumerate(header):
                table[ix].insert(0, heading)
        else:
            table = [[heading] for heading in header]
    self.header = (kwargs.pop('header', self.header) if self.header else False)
    hchar = kwargs.pop('header_line_char', '~')
    self.header_line_char = (hchar[0] if hchar else '~')
    border = kwargs.pop('border', 'tablecols')
    if (border is None):
        border = 'none'
    if (border not in ('none', 'table', 'tablecols', 'header', 'incols', 'cols', 'rows', 'cells')):
        raise Exception(("Unsupported    border    type:    '%s'" % border))
    self.border = border
    self.border_width = kwargs.get('border_width', 1)
    self.corner_char = kwargs.get('corner_char', '+')
    pcorners = kwargs.pop('pretty_corners', False)
    self.corner_top_left_char = _to_ansi(kwargs.pop('corner_top_left_char', ('.' if pcorners else self.corner_char)))
    self.corner_top_right_char = _to_ansi(kwargs.pop('corner_top_right_char', ('.' if pcorners else self.corner_char)))
    self.corner_bottom_left_char = _to_ansi(kwargs.pop('corner_bottom_left_char', ('    ' if pcorners else self.corner_char)))
    self.corner_bottom_right_char = _to_ansi(kwargs.pop('corner_bottom_right_char', ('    ' if pcorners else self.corner_char)))
    self.width = kwargs.pop('width', None)
    self.height = kwargs.pop('height', None)
    self.evenwidth = kwargs.pop('evenwidth', False)
    self.maxwidth = kwargs.pop('maxwidth', None)
    if (self.maxwidth and self.width and (self.maxwidth < self.width)):
        raise Exception('table    maxwidth    <    table    width!')
    self.ncols = len(table)
    self.nrows = (max((len(col) for col in table)) if table else 0)
    self.nwidth = 0
    self.nheight = 0
    self.options = kwargs
    self.table = [EvColumn(*col, **kwargs) for col in table]
    self.worktable = None
