def _get_candidate_ops_lists_from_var(self, var: Var) -> List[List[Operation]]:
        """
        Return a list of lists.
        Each element is a list of a subset of the child ops of var, which satisfies the following conditions:
        - they are of the same op_type
        - ops are not repeated in it. The .child_ops property of a var may sometimes contain an op repeated more than once
        - the ops are ordered based on the order in which they appear in the block.operations list (which is topologically sorted),
          with ops appearing earlier in that list appearing first here.
        """
        candidate_ops_lists = []

        op_types_to_ops = collections.OrderedDict()
        for op in var.child_ops:
            if op.op_type in op_types_to_ops:
                op_types_to_ops[op.op_type].append(op)
            else:
                op_types_to_ops[op.op_type] = [op]

        for v in op_types_to_ops.values():
            if len(v) > 1:
                candidate_ops_list = self._get_candidate_ops_list(v)
                if len(candidate_ops_list) > 1:
                    candidate_ops_lists.append(candidate_ops_list)

        return candidate_ops_lists

        Return a list of lists.
        Each element is a list of a subset of the child ops of var, which satisfies the following conditions:
        - they are of the same op_type
        - ops are not repeated in it. The .child_ops property of a var may sometimes contain an op repeated more than once
        - the ops are ordered based on the order in which they appear in the block.operations list (which is topologically sorted),
          with ops appearing earlier in that list appearing first here.
        
coremltools/converters/mil/mil/passes/defs/cleanup/remove_redundant_ops.py