<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def list_tags():
 """Lists the available tags. Returns: Tuple of tuples. Child tuples are four items: ('opening tag', 'closing tag', main ansi value, closing ansi value). """

    codes = _AutoCodes()
    grouped = set([(k, '/{0}'.format(k), codes[k], codes['/{0}'.format(k)]) for k in codes if not k.startswith('/')])

    # Add half-tags like /all.
    found = [c for r in grouped for c in r[:2]]
    missing = set([('', r[0], None, r[1]) if r[0].startswith('/') else (r[0], '', r[1], None)
                   for r in _AutoCodes().items() if r[0] not in found])
    grouped |= missing

    # Sort.
    payload = sorted([i for i in grouped if i[2] is None], key=lambda x: x[3])  # /all /fg /bg
    grouped -= set(payload)
    payload.extend(sorted([i for i in grouped if i[2] < 10], key=lambda x: x[2]))  # b i u flash
    grouped -= set(payload)
    payload.extend(sorted([i for i in grouped if i[0].startswith('auto')], key=lambda x: x[2]))  # auto colors
    grouped -= set(payload)
    payload.extend(sorted([i for i in grouped if not i[0].startswith('hi')], key=lambda x: x[2]))  # dark colors
    grouped -= set(payload)
    payload.extend(sorted(grouped, key=lambda x: x[2]))  # light colors
    return tuple(payload)