code: def list_tags():
      
      # Build reverse dictionary. Keys are closing tags, values are [closing ansi, opening tag, opening ansi].
      reverse_dict = dict()
      for tag, ansi in sorted(BASE_CODES.items()):
          if tag.startswith('/'):
              reverse_dict[tag] = [ansi, None, None]
          else:
              reverse_dict['/' + tag][1:] = [tag, ansi]
  
      # Collapse
      four_item_tuples = [(v[1], k, v[2], v[0]) for k, v in reverse_dict.items()]
  
      # Sort.
      def sorter(four_item):
          """Sort /all /fg /bg first, then b i u flash, then auto colors, then dark colors, finally light colors.
  
          :param iter four_item: [opening tag, closing tag, main ansi value, closing ansi value]
  
          :return Sorting weight.
          :rtype: int
          """
          if not four_item[2]:  # /all /fg /bg
              return four_item[3] - 200
          if four_item[2] < 10 or four_item[0].startswith('auto'):  # b f i u or auto colors
              return four_item[2] - 100
          return four_item[2]
      four_item_tuples.sort(key=sorter)
  
      return four_item_tuples
docs: List the available tags.
  
      :return: List of 4-item tuples: opening tag, closing tag, main ansi value, closing ansi value.
      :rtype: list