def register_sizer(self, attr_name, sizedimage_cls):
if attr_name.startswith(<EOL>'<STR_LIT:_>'<EOL>) or attr_name in self.unallowed_sizer_names:<EOL><INDENT>raise UnallowedSizerName(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % (<EOL>attr_name,<EOL>'<STR_LIT:U+002CU+0020>'.join([<EOL>name<EOL>for name in self.unallowed_sizer_names<EOL>])<EOL>)<EOL>)<EOL><DEDENT>if not issubclass(sizedimage_cls, SizedImage):<EOL><INDENT>raise InvalidSizedImageSubclass(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>)<EOL><DEDENT>if attr_name in self._sizedimage_registry:<EOL><INDENT>raise AlreadyRegistered(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' % attr_name<EOL>)<EOL><DEDENT>else:<EOL><INDENT>self._sizedimage_registry[attr_name] = sizedimage_cls<EOL><DEDENT>
Register a new SizedImage subclass (`sizedimage_cls`).

To be used via the attribute (`attr_name`).