code: def get_annotated_list_qs(cls, qs):
          
          result, info = [], {}
          start_depth, prev_depth = (None, None)
          for node in qs:
              depth = node.get_depth()
              if start_depth is None:
                  start_depth = depth
              open = (depth and (prev_depth is None or depth > prev_depth))
              if prev_depth is not None and depth < prev_depth:
                  info['close'] = list(range(0, prev_depth - depth))
              info = {'open': open, 'close': [], 'level': depth - start_depth}
              result.append((node, info,))
              prev_depth = depth
          if start_depth and start_depth > 0:
              info['close'] = list(range(0, prev_depth - start_depth + 1))
          return result
docs: Gets an annotated list from a queryset.