<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_dict(self):
 """ Create a JSON-serializable representation of the ISA. The dictionary representation is of the form:: { "1Q": { "0": { "type": "Xhalves" }, "1": { "type": "Xhalves", "dead": True }, }, "2Q": { "1-4": { "type": "CZ" }, "1-5": { "type": "CZ" }, }, } :return: A dictionary representation of self. :rtype: Dict[str, Any] """


        def _maybe_configure(o, t):
            # type: (Union[Qubit,Edge], str) -> dict
            """
            Exclude default values from generated dictionary.

            :param Union[Qubit,Edge] o: The object to serialize
            :param str t: The default value for ``o.type``.
            :return: d
            """
            d = {}
            if o.type != t:
                d["type"] = o.type
            if o.dead:
                d["dead"] = o.dead
            return d

        return {
            "1Q": {"{}".format(q.id): _maybe_configure(q, DEFAULT_QUBIT_TYPE) for q in self.qubits},
            "2Q": {"{}-{}".format(*edge.targets): _maybe_configure(edge, DEFAULT_EDGE_TYPE)
                   for edge in self.edges}
        }