import collections


def build_toc_item(title, path=None, sub_items=None):
    """Create an item in the TOC.

    Args:
      title (str) - Title for this item.
      path (str) - Path to the page for this item.
      sub_items (list) - Items to place in a collapsible subsection.
    """
    item = collections.OrderedDict()
    item["title"] = title
    if path:
        item["path"] = path
    if sub_items:
        item["section"] = sub_items
    return item