Populate widget with nested catalogs

def expand_nested(self, cats):
        """Populate widget with nested catalogs"""
        down = '│'
        right = '└──'

        def get_children(parent):
            return [e() for e in parent._entries.values() if e._container == 'catalog']

        if len(cats) == 0:
            return

        cat = cats[0]
        old = list(self.options.items())
        name = next(k for k, v in old if v == cat)
        index = next(i for i, (k, v) in enumerate(old) if v == cat)
        if right in name:
            prefix = f'{name.split(right)[0]}{down} {right}'
        else:
            prefix = right

        children = get_children(cat)
        for i, child in enumerate(children):
            old.insert(index+i+1, (f'{prefix} {child.name}', child))
        self.widget.options = dict(old)