def table_options(opt_type, with_keys=True):
    """
    Generates a textual represenation (not unicode) of div.table-options for jsified Tables.
    This html serves as a sort of toolbars (compulsory) to the operations on a jsified table.
    """
    l = ['<div class="table-options">']
    ctrls = ['all', 'none']
    l.append('<p class="">')
    if not with_keys:
        l.append('<span style="color:#888;">[No primary keys defined]</span>')
    else:
        l.append('<span>{0}</span>'.format('Columns:' if opt_type == 'tbls'
             else 'Select: '))
        for ctrl in ctrls:
            l.append('<a class="selector select_{0}">{1}</a>'.format(ctrl,
                ctrl.title()))
        l.append('<span>With Selected: </span>')
        if opt_type == 'user' or opt_type == 'data':
            ctrls = 'edit', 'delete'
        elif opt_type == 'tbl':
            ctrls = 'empty', 'drop'
        elif opt_type == 'db':
            ctrls = 'drop',
        elif opt_type == 'seq':
            ctrls = 'drop', 'reset'
        elif opt_type == 'tbl_like':
            ctrls = 'drop',
        for ctrl in ctrls:
            l.append('<a class="doer needy_doer action_{0}">{1}</a>'.format
                (ctrl, ctrl.title()))
        if opt_type == 'data':
            l.append(
                '<a class="doer action_refresh" style="margin-left:20px">Refresh</a>'
                )
    l.append('</p></div>')
    return ''.join(l)
