def finalize(self, sender, **kwargs):
        try:
            hint_class = self.cls
        except __HOLE__:  # called via `register`
            pass
        else:
            if hint_class is not sender:  # set in concrete
                if not (self.inherit and issubclass(sender, hint_class)):  # set in abstract
                    return
        if hasattr(sender._meta, 'simple_history_manager_attribute'):
            raise exceptions.MultipleRegistrationsError('{}.{} registered multiple times for history tracking.'.format(
                sender._meta.app_label,
                sender._meta.object_name,
            ))
        history_model = self.create_history_model(sender)
        module = importlib.import_module(self.module)
        setattr(module, history_model.__name__, history_model)

        # The HistoricalRecords object will be discarded,
        # so the signal handlers can't use weak references.
        models.signals.post_save.connect(self.post_save, sender=sender,
                                         weak=False)
        models.signals.post_delete.connect(self.post_delete, sender=sender,
                                           weak=False)

        descriptor = HistoryDescriptor(history_model)
        setattr(sender, self.manager_name, descriptor)
        sender._meta.simple_history_manager_attribute = self.manager_name
dataset/ETHPy150Open treyhunner/django-simple-history/simple_history/models.py/HistoricalRecords.finalize