code: def rename_retract_ar_transition(portal):
      
      logger.info("Renaming 'retract_ar' transition to 'invalidate'")
      wf_tool = api.get_tool("portal_workflow")
      workflow = wf_tool.getWorkflowById("bika_ar_workflow")
  
      if "invalidate" not in workflow.transitions:
          workflow.transitions.addTransition("invalidate")
      transition = workflow.transitions.invalidate
      transition.setProperties(
          title="Invalidate",
          new_state_id="invalid",
          after_script_name="",
          actbox_name="Invalidate",
      )
      guard = transition.guard or Guard()
      guard_props = {"guard_permissions": "BIKA: Retract",
                     "guard_roles": "",
                     "guard_expr": "python:here.guard_cancelled_object()"}
      guard.changeFromProperties(guard_props)
      transition.guard = guard
  
      for state in workflow.states.values():
          if 'retract_ar' in state.transitions:
              trans = filter(lambda id: id != 'retract_ar', state.transitions)
              trans += ('invalidate', )
              state.transitions = trans
  
      if "retract_ar" in workflow.transitions:
          workflow.transitions.deleteTransitions(["retract_ar"])
docs: Renames retract_ar transition to invalidate