def xplets_to_serializable_dict(model):
    """
    Create a dictionary of doublets, triplets and quadruplets left after model building (i.e. used in the QUBO).
    The dictionary has the form `str(xplet) -> dict(xplet)`, where `dict(xplet)` contains all the attributes
    of the xplet, except the lists of inner and outer connections. Note that attributes of type Xplet are transformed
    into string.

    .. warning::
        This only works after model building (i.e. call to :py:meth:`hepqpr.qallse.QallseBase.build_model`).
        Also, some implementations might modify the xplets during qubo building, so it is better to call
        `model.to_qubo` beforehand.

    :param model: an implementation of :py:class:`hepqpr.qallse.QallseBase`
    :return: a dict without cyclic references.
    """
    xplets = []
    for xs in [model.qubo_doublets, model.qubo_triplets, model.quadruplets]:
        xplets += [(str(x), x.to_dict()) for x in xs]
    return dict(xplets)