def get_max_opset_version_and_op(self) -> Tuple[_target, Operation]:
        """
        Find the max opset version among all operations in the function.
        Returns the opset version Enum and the corresponding op.
        """
        max_opset_version = _target.iOS13
        op_with_max_opset_version = None

        def update_max_opset_version_block(block):
            nonlocal max_opset_version
            nonlocal op_with_max_opset_version
            for op in block.operations:
                for b in op.blocks:
                    update_max_opset_version_block(b)
                if not hasattr(op, "_op_variants") or not isinstance(op._op_variants, dict):
                    continue
                if op.opset_version > max_opset_version:
                    max_opset_version = op.opset_version
                    op_with_max_opset_version = op

        update_max_opset_version_block(self)
        return max_opset_version, op_with_max_opset_version

        Find the max opset version among all operations in the function.
        Returns the opset version Enum and the corresponding op.
        
coremltools/converters/mil/mil/block.py