<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def guard_reinstate(analysis_request):
 """Returns whether 'reinstate" transition can be performed or not. Returns True only if this is not a partition or the parent analysis request can be reinstated or is not in a cancelled state """

    parent = analysis_request.getParentAnalysisRequest()
    if not parent:
        return True
    if api.get_workflow_status_of(parent) != "cancelled":
        return True
    return isTransitionAllowed(parent, "reinstate")