code: def after_reinstate(analysis_request):
      
      do_action_to_descendants(analysis_request, "reinstate")
      do_action_to_analyses(analysis_request, "reinstate")
  
      # Force the transition to previous state before the request was cancelled
      prev_status = get_prev_status_from_history(analysis_request, "cancelled")
      changeWorkflowState(analysis_request, AR_WORKFLOW_ID, prev_status,
                          action="reinstate")
      analysis_request.reindexObject()
docs: Method triggered after a 'reinstate' transition for the Analysis Request
      passed in is performed. Sets its status to the last status before it was
      cancelled. Reinstates the descendant partitions and all the analyses
      associated to the analysis request as well.