def get_sec_names(cfg):
    """Get section names as list from top to bottom ['sec0','sec1',...]"""
    if cfg.depth == 0:
        return []
    secnames = [cfg.name]
    for i in range(cfg.depth - 1):
        cfg = cfg.parent
        secnames.append(cfg.name)
    return secnames[::-1]