code: def after_deactivate_transition_event(self):
          
          # Remove the service from profiles to which is assigned
          profiles = self.getBackReferences('AnalysisProfileAnalysisService')
          for profile in profiles:
              profile.remove_service(self)
  
          # Remove the service from templates to which is assigned
          bsc = api.get_tool('bika_setup_catalog')
          templates = bsc(portal_type='ARTemplate')
          for template in templates:
              template = api.get_object(template)
              template.remove_service(self)
docs: Method triggered after a 'deactivate' transition for the current
          AnalysisService is performed. Removes this service from the Analysis
          Profiles or Analysis Request Templates where is assigned.
          This function is called automatically by
          bika.lims.workflow.AfterTransitionEventHandler