'Inserts a new row from the given field parameters, returns id.'

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

    commit = kwargs.pop('commit', True)
    if ((len(args) == 0) and (len(kwargs) == 1) and isinstance(kwargs.get('values'), dict)):
        kwargs = kwargs['values']
    elif ((len(args) == 1) and isinstance(args[0], dict)):
        kwargs = dict(args[0], **kwargs)
    elif ((len(args) == 1) and isinstance(args[0], (list, tuple))):
        kwargs = dict(zip((f for f in self.fields if (f != self.pk)), args[0]))
    if (len(self.default) > 0):
        kwargs.update(self.default)
    k = ',    '.join((('`%s`' % k) for k in kwargs.keys()))
    v = ',    '.join((self.db.escape(v) for v in kwargs.values()))
    q = ('insert    into    `%s`    (%s)    values    (%s);' % (self.name, k, v))
    self.db.execute(q, commit)
    return self._insert_id()
