'Add a new row before the given ``index`` position in the table.
The ``vals`` argument can be:
sequence (e.g. tuple or list)
Column values in the same order as table columns.
mapping (e.g. dict)
Keys corresponding to column names.  Missing values will be
filled with np.zeros for the column dtype.
`None`
All values filled with np.zeros for the column dtype.
The ``mask`` attribute should give (if desired) the mask for the
values. The type of the mask should match that of the values, i.e. if
``vals`` is an iterable, then ``mask`` should also be an iterable
with the same length, and if ``vals`` is a mapping, then ``mask``
should be a dictionary.
Parameters
vals : tuple, list, dict or `None`
Use the specified values in the new row
mask : tuple, list, dict or `None`
Use the specified mask values in the new row'

def insert_row(self, index, vals=None, mask=None):

    colnames = self.colnames
    N = len(self)
    if ((index < (- N)) or (index > N)):
        raise IndexError(u'Index    {0}    is    out    of    bounds    for    table    with    length    {1}'.format(index, N))
    if (index < 0):
        index += N
    def _is_mapping(obj):
        u'Minimal    checker    for    mapping    (dict-like)    interface    for    obj'
        attrs = (u'__getitem__', u'__len__', u'__iter__', u'keys', u'values', u'items')
        return all((hasattr(obj, attr) for attr in attrs))
    if ((mask is not None) and (not self.masked)):
        self._set_masked(True)
    if (_is_mapping(vals) or (vals is None)):
        if ((mask is not None) and (not _is_mapping(mask))):
            raise TypeError(u'Mismatch    between    type    of    vals    and    mask')
        if ((mask is not None) and (set(vals.keys()) != set(mask.keys()))):
            raise ValueError(u'keys    in    mask    should    match    keys    in    vals')
        if (vals and any(((name not in colnames) for name in vals))):
            raise ValueError(u'Keys    in    vals    must    all    be    valid    column    names')
        vals_list = []
        mask_list = []
        for name in colnames:
            if (vals and (name in vals)):
                vals_list.append(vals[name])
                mask_list.append((False if (mask is None) else mask[name]))
            else:
                col = self[name]
                if hasattr(col, u'dtype'):
                    vals_list.append(np.zeros(shape=(), dtype=col.dtype))
                    mask_list.append((self.masked and (vals is not None)))
                else:
                    raise ValueError(u"Value    must    be    supplied    for    column    '{0}'".format(name))
        vals = vals_list
        mask = mask_list
    if isiterable(vals):
        if ((mask is not None) and ((not isiterable(mask)) or _is_mapping(mask))):
            raise TypeError(u'Mismatch    between    type    of    vals    and    mask')
        if (len(self.columns) != len(vals)):
            raise ValueError(u'Mismatch    between    number    of    vals    and    columns')
        if (mask is not None):
            if (len(self.columns) != len(mask)):
                raise ValueError(u'Mismatch    between    number    of    masks    and    columns')
        else:
            mask = ([False] * len(self.columns))
    else:
        raise TypeError(u'Vals    must    be    an    iterable    or    mapping    or    None')
    columns = self.TableColumns()
    try:
        for (name, col, val, mask_) in zip(colnames, self.columns.values(), vals, mask):
            if (isinstance(col, Column) and (not isinstance(col, self.ColumnClass))):
                col = self.ColumnClass(col, copy=False)
            newcol = col.insert(index, val, axis=0)
            if (not isinstance(newcol, BaseColumn)):
                newcol.info.name = name
                if self.masked:
                    newcol.mask = FalseArray(newcol.shape)
            if (len(newcol) != (N + 1)):
                raise ValueError(u'Incorrect    length    for    column    {0}    after    inserting    {1}    (expected    {2},    got    {3})'.format(name, val, len(newcol), (N + 1)))
            newcol.info.parent_table = self
            if self.masked:
                newcol.mask[index] = mask_
            columns[name] = newcol
        for table_index in self.indices:
            table_index.insert_row(index, vals, self.columns.values())
    except Exception as err:
        raise ValueError(u"Unable    to    insert    row    because    of    exception    in    column    '{0}':\n{1}".format(name, err))
    else:
        self._replace_cols(columns)
        if hasattr(self, u'_groups'):
            del self._groups
