code: def _make_index(self):
          
  
          out = {}
  
          for layer in self._layers:
              cls = layer.__class__
              out[cls] = out.get(cls, []) + [layer]
  
          return out
docs: Perform the index computation. It groups layers by type into a
          dictionary, to allow quick access.