code: def pre_install(portal_setup):
      
      logger.info("SENAITE LIMS pre-install handler [BEGIN]")
  
      # https://docs.plone.org/develop/addons/components/genericsetup.html#custom-installer-code-setuphandlers-py
      profile_id = "profile-senaite.lims:default"
      context = portal_setup._getImportContext(profile_id)
      portal = context.getSite()  # noqa
  
      # Only install the core once!
      qi = portal.portal_quickinstaller
      if not qi.isProductInstalled("bika.lims"):
          portal_setup.runAllImportStepsFromProfile("profile-bika.lims:default")
  
      logger.info("SENAITE LIMS pre-install handler [DONE]")
docs: Runs berfore the first import step of the *default* profile
  
      This handler is registered as a *pre_handler* in the generic setup profile
  
      :param portal_setup: SetupTool