code: def get_cnts_levels_depths_recs(recs):
          
          cnts = cx.defaultdict(lambda: cx.defaultdict(cx.Counter))
          for rec in recs:
              if rec is not None and not rec.is_obsolete:
                  cnts['level'][rec.level][rec.namespace] += 1
                  cnts['depth'][rec.depth][rec.namespace] += 1
          return cnts
docs: Collect counts of levels and depths in a Group of GO Terms.