code: def install_wrapper(cls, install, new_class):
          
          def _wrapped(self, *args, **kwargs):
              if self.installed:
                  raise AssertionError('Module %s is already installed'
                                       % self.verbose_name)
  
              logger.info("Installing %s module" % self.verbose_name)
              pre_install.send(sender=self)
              res = install(self, *args, **kwargs)
              post_install.send(sender=self)
  
              info = self._info
              info.status = ModuleInfo.DISABLED
              info.save()
  
              logger.info("Installed %s module" % self.verbose_name)
              return res
  
          return _wrapped
docs: Wrap the install method to call pre and post enable signals and update
          module status