code: def subclass(self, namedstruct):
          '''
          Sub-class a NamedStruct into correct sub types.
          
          :param namedstruct: a NamedStruct of this type.
          '''
          cp = self
          cs = namedstruct
          while True:
              if hasattr(cs, '_sub'):
                  cs = cs._sub
                  cp = cs._parser
                  continue
              subp = None
              clsfr = getattr(cp, 'classifier', None)
              if clsfr is not None:
                  clsvalue = clsfr(namedstruct)
                  subp = cp.subindices.get(clsvalue)
              if subp is None:
                  for sc in cp.subclasses:
                      if sc.isinstance(namedstruct):
                          subp = sc
                          break
              if subp is None:
                  break
              cs._subclass(subp)
              cs = cs._sub
              cp = subf subclass(self, namedstruct):
          '''
          Sub-class a NamedStruct into correct sub types.
          
          :param namedstruct: a NamedStruct of this type.
          '''
          cp = self
          cs = namedstruct
          while True:
              if hasattr(cs, '_sub'):
                  cs = cs._sub
                  cp = cs._parser
                  continue
              subp = None
              clsfr = getattr(cp, 'classifier', None)
              if clsfr is not None:
                  clsvalue = clsfr(namedstruct)
                  subp = cp.subindices.get(clsvalue)
              if subp is None:
                  for sc in cp.subclasses:
                      if sc.isinstance(namedstruct):
                          subp = sc
                          break
              if subp is None:
                  break
              cs._subclass(subp)
              cs = cs._sub
              cp = subp
docs: Sub-class a NamedStruct into correct sub types.
          
          :param namedstruct: a NamedStruct of this type.