code: def register_subclass(cls):
      
  
      key = cls.interface_type, cls.resource_class
  
      if key in _SUBCLASSES:
          raise ValueError('Class already registered for %s and %s' % key)
  
      _SUBCLASSES[(cls.interface_type, cls.resource_class)] = cls
  
      _INTERFACE_TYPES.add(cls.interface_type)
      _RESOURCE_CLASSES[cls.interface_type].add(cls.resource_class)
  
      if cls.is_rc_optional:
          if cls.interface_type in _DEFAULT_RC:
              raise ValueError('Default already specified for %s' %
                               cls.interface_type)
          _DEFAULT_RC[cls.interface_type] = cls.resource_class
  
      return cls
docs: Register a subclass for a given interface type and resource class.