def construct_debug_handle_to_ops_mapping(self) -> Dict:
        """
        For PyMIL program translated from ExecuTorch only: Based on scope info inherited from EXIR,
        construct a debug handle to ops mapping. The mapping format is something like
        {
          1: [
            {"Type": "Program"},
            {"Type": "Function", "Name": "main"},
            {"Type": "Block"},
            {"Type": "Operation", "Operator": "add", "Output": "z"}
          ]
        }
        where `1`, `"main"`, `"add"`, and `"z"` are example values of
        the debug handle, function name, operation type,
        and output var name (or the name of the first output var, if multiple outputs)
        """
        debug_handle_to_ops_mapping = {}
        for function_name, function in self.functions.items():
            if ScopeSource.EXIR_DEBUG_HANDLE not in function._essential_scope_sources:
                raise NotImplementedError(
                    f"Function ({function_name}) must have EXIR_DEBUG_HANDLE as an essential scope source."
                )
            for operation in function.operations:
                # TODO (rdar://115846569): Handle multi-block case from EXIR
                if len(operation.blocks) > 0:
                    raise NotImplementedError("Multi-block case has not been supported yet")
                debug_handle = operation.scopes[ScopeSource.EXIR_DEBUG_HANDLE]
                if debug_handle is None:
                    continue
                debug_handle = debug_handle[0]
                if debug_handle not in debug_handle_to_ops_mapping:
                    debug_handle_to_ops_mapping[debug_handle] = []
                debug_handle_to_ops_mapping[debug_handle].append(
                    [
                        {"Type": "Program"},
                        {"Type": "Function", "Name": function_name},
                        {"Type": "Block"},
                        {
                            "Type": "Operation",
                            "Operator": operation.op_type,
                            "Output": operation.outputs[0].name,
                        },
                    ]
                )
        return debug_handle_to_ops_mapping

        For PyMIL program translated from ExecuTorch only: Based on scope info inherited from EXIR,
        construct a debug handle to ops mapping. The mapping format is something like
        {
          1: [
            {"Type": "Program"},
            {"Type": "Function", "Name": "main"},
            {"Type": "Block"},
            {"Type": "Operation", "Operator": "add", "Output": "z"}
          ]
        }
        where `1`, `"main"`, `"add"`, and `"z"` are example values of
        the debug handle, function name, operation type,
        and output var name (or the name of the first output var, if multiple outputs)
        
coremltools/converters/mil/mil/program.py