def match_pattern(self, op: Operation) -> Tuple[Operation, Operation, Operation]:
        """
        try to match distributive quantized binary op:
                ...
                 ^
                 |
            dequantize(x) -|
                           |-> op(x, y) (-> relu) -> quantize(z)
            dequantize(y) -|
                 |
                 v
                ...

        return dequantize_x, dequantize_y, quantize_z for further transformation

        return None if no match
        """
        # make sure the op is distributive
        if op.op_type not in self.DISTRIBUTIVE_BINARY_OPS:
            return None

        # quantized op may be fused with relu
        # relu would not affect distributivity
        tail_op = op
        if _check_child_op_type(op, "relu"):
            tail_op = op.outputs[0].child_ops[0]

        # make sure the inputs are quantized
        dequantize_x = op.x.op
        dequantize_y = op.y.op
        if (
            dequantize_x is None
            or dequantize_y is None
            or dequantize_x.op_type != "dequantize"
            or dequantize_y.op_type != "dequantize"
        ):
            return None

        # make sure the output is quantized
        if not _check_child_op_type(tail_op, "quantize"):
            return None
        quantize_z = tail_op.outputs[0].child_ops[0]

        # make sure the intermediate results are not block outputs
        # since we only guarantee conservation of z
        if not _check_no_output_connection(
            op.enclosing_block, [dequantize_x, dequantize_y, op, tail_op, quantize_z]
        ):
            return None

        return dequantize_x, dequantize_y, quantize_z

        try to match distributive quantized binary op:
                ...
                 ^
                 |
            dequantize(x) -|
                           |-> op(x, y) (-> relu) -> quantize(z)
            dequantize(y) -|
                 |
                 v
                ...

        return dequantize_x, dequantize_y, quantize_z for further transformation

        return None if no match
        
coremltools/converters/mil/mil/passes/defs/optimize_quantization.py