docs: def source_model_info(nodes):
      """
      Extract information about NRML/0.5 source models. Returns a table
      with TRTs as rows and source classes as columns.
      """
      c = collections.Counter()
      for node in nodes:
          for src_group in node:
              trt = src_group['tectonicRegion']
              for src in src_group:
                  src_class = src.tag.split('}')[1]
                  c[trt, src_class] += 1
      trts, classes = zip(*c)
      trts = sorted(set(trts))
      classes = sorted(set(classes))
      dtlist = [('TRT', (bytes, 30))] + [(name, int) for name in classes]
      out = numpy.zeros(len(trts) + 1, dtlist)  # +1 for the totals
      for i, trt in enumerate(trts):
          out[i]['TRT'] = trt
          for src_class in classes:
              out[i][src_class] = c[trt, src_class]
      out[-1]['TRT'] = 'Total'
      for name in out.dtype.names[1:]:
          out[-1][name] = out[name][:-1].sum()
      return rst_table(out)