code: def remove_sample_prep_workflow(portal):
      
      # There is no need to walk through objects because of:
      # https://github.com/senaite/senaite.core/blob/master/bika/lims/upgrade/v01_02_008.py#L187
      logger.info("Removing 'sample_prep' related states and transitions ...")
      workflow_ids = ["bika_sample_workflow",
                      "bika_ar_workflow",
                      "bika_analysis_workflow"]
      to_remove = ["sample_prep", "sample_prep_complete"]
      wf_tool = api.get_tool("portal_workflow")
      for wf_id in workflow_ids:
          workflow = wf_tool.getWorkflowById(wf_id)
          for state_trans in to_remove:
              if state_trans in workflow.transitions:
                  logger.info("Removing transition '{}' from '{}'"
                              .format(state_trans, wf_id))
                  workflow.transitions.deleteTransitions([state_trans])
              if state_trans in workflow.states:
                  logger.info("Removing state '{}' from '{}'"
                              .format(state_trans, wf_id))
                  workflow.states.deleteStates([state_trans])
docs: Removes sample_prep and sample_prep_complete transitions