def to_sections(idl_parsed):
    """
    Iterates through elements in idl_parsed list and returns a list of section dicts.
    Currently elements of type "comment", "enum", "struct", and "interface" are processed.

    :Parameters:
      idl_parsed
        Barrister parsed IDL
    """
    sections = []
    for entity in idl_parsed:
        if entity["type"] == "comment":
            sections.append(to_section(entity["value"], ""))
        elif entity["type"] == "enum":
            sections.append(parse_enum(entity))
        elif entity["type"] == "struct":
            sections.append(parse_struct(entity))
        elif entity["type"] == "interface":
            sections.extend(parse_interface(entity))
    return sections
Iterates through elements in idl_parsed list and returns a list of section dicts.
    Currently elements of type "comment", "enum", "struct", and "interface" are processed.

    :Parameters:
      idl_parsed
        Barrister parsed IDL