def try_replace_uses_of_var_after_op(
        self,
        anchor_op: Operation,
        old_var: Var,
        new_var: Var,
        end_op: Optional[Operation] = None,
        no_check_var_types: Optional[bool] = False,
    ):
        """
        :param anchor_op: Operation
        :param old_var: Var
        :param new_var: Var
        :param end_op: Operation
        :param no_check_var_types: bool
        :return: True if the old_var can be replaced by new_var. False otherwsie.

        This helper function guards the replace_uses_of_var_after_op function,
        by first checking if the old_var could be replaced by the new_var.

        1. If old_var can be replaced by new_var, the replace_uses_of_var_after_op is called,
        and returns True. 2. Return False if the replacement is not allow.
        """
        if not old_var.can_be_replaced_by_var(new_var):
            return False

        self.replace_uses_of_var_after_op(
            anchor_op=anchor_op,
            end_op=end_op,
            old_var=old_var,
            new_var=new_var,
            no_check_var_types=no_check_var_types,
        )
        return True

        :param anchor_op: Operation
        :param old_var: Var
        :param new_var: Var
        :param end_op: Operation
        :param no_check_var_types: bool
        :return: True if the old_var can be replaced by new_var. False otherwsie.

        This helper function guards the replace_uses_of_var_after_op function,
        by first checking if the old_var could be replaced by the new_var.

        1. If old_var can be replaced by new_var, the replace_uses_of_var_after_op is called,
        and returns True. 2. Return False if the replacement is not allow.
        
coremltools/converters/mil/mil/block.py