def METHOD_NAME(self, cls):
    """Register a resource with the factory.
    Returns the class to allow using it as a decorator."""
    cls_name = cls.__name__
    if cls_name in self.all_classes:
        raise RegistrationError(f"resource with name {cls_name} was already registered")
    self.resources[cls.__name__] = cls
    self._insert_into_all(cls)
    return cls