def _depth(self, *, stop_at_depth: Optional[int] = None, cur_depth: int = 0):
        """Return the depth of the LazyIndices tree.
        Use it only to eagerify early to avoid RecursionErrors.
        """
        if stop_at_depth is not None and cur_depth >= stop_at_depth:
            return 0

        if self._eager_list is not None:
            return 0

        assert self._lists is not None

        # List kept mostly for debugging purposes, can be replaced with a single int
        lens = [0]
        for ll in self._lists:
            if isinstance(ll, LazyIndices):
                lens.append(
                    ll._depth(stop_at_depth=stop_at_depth, cur_depth=cur_depth + 1)
                )

        return max(lens) + 1
Return the depth of the LazyIndices tree.
        Use it only to eagerify early to avoid RecursionErrors.
        
avalanche/benchmarks/utils/flat_data.py