def METHOD_NAME(t):
    if not (t.task_spec.name == step_name_path[-1] or t.task_spec.bpmn_name == step_name_path[-1]):
        return False
    for parent_name in step_name_path[:-1]:
        p = t.parent
        found = False
        while (p and p != p.parent):
            if (p.task_spec.name == parent_name or p.task_spec.bpmn_name == parent_name):
                found = True
                break
            if p.parent is None and p.workflow != p.workflow.parent:
                p = switch_workflow(p)
            else:
                p = p.parent
        if not found:
            return False
    return True