def list_str(list_, **listkw):
    r
    import utool as ut
    newlines = listkw.pop('nl', listkw.pop('newlines', 1))
    packed = listkw.pop('packed', False)
    truncate = listkw.pop('truncate', False)
    listkw['nl'] = _rectify_countdown_or_bool(newlines)
    listkw['truncate'] = _rectify_countdown_or_bool(truncate)
    listkw['packed'] = _rectify_countdown_or_bool(packed)
    nobraces = listkw.pop('nobr', listkw.pop('nobraces', False))
    itemsep = listkw.get('itemsep', ' ')
    trailing_sep = listkw.get('trailing_sep', True)
    with_comma = True
    itemstr_list = get_itemstr_list(list_, **listkw)
    is_tuple = isinstance(list_, tuple)
    is_set = isinstance(list_, (set, frozenset, ut.oset))
    is_onetup = isinstance(list_, (tuple)) and len(list_) <= 1
    if nobraces:
        lbr, rbr = '', ''
    elif is_tuple:
        lbr, rbr  = '(', ')'
    elif is_set:
        lbr, rbr  = '{', '}'
    else:
        lbr, rbr  = '[', ']'
    if len(itemstr_list) == 0:
        newlines = False
    if newlines is not False and (newlines is True or newlines > 0):
        sep = ',\n' if with_comma else '\n'
        if nobraces:
            body_str = sep.join(itemstr_list)
            if trailing_sep:
                body_str += ','
            retstr = body_str
        else:
            if packed:
                joinstr = sep + itemsep * len(lbr)
                body_str = joinstr.join([itemstr for itemstr in itemstr_list])
                if trailing_sep:
                    body_str += ','
                braced_body_str = (lbr + '' + body_str + '' + rbr)
            else:
                body_str = sep.join([
                    ut.indent(itemstr) for itemstr in itemstr_list])
                if trailing_sep:
                    body_str += ','
                braced_body_str = (lbr + '\n' + body_str + '\n' + rbr)
            retstr = braced_body_str
    else:
        sep = ',' + itemsep if with_comma else itemsep
        body_str = sep.join(itemstr_list)
        if is_onetup:
            body_str += ','
        retstr  = (lbr + body_str +  rbr)
    do_truncate = truncate is not False and (truncate is True or truncate == 0)
    if do_truncate:
        truncatekw = listkw.get('truncatekw', {})
        retstr = truncate_str(retstr, **truncatekw)
    return retstr