def get_info(model):
    """get_info.

    Create a basic representation of the qubovert object encoded by ``model``.
    This basic representation is easily shareable. It works so that
    ``model == qv.utils.create_from_info(qv.utils.get_info(model))`` is True.

    Parameters
    ----------
    model : type in ``qubovert.BOOLEAN_MODELS`` or ``qubovert.SPIN_MODELS``.

    Returns
    -------
    res : dict.
        ``res`` will have many fields. The first is ``type`` which will
        indicate which qubovert type ``model`` is. Then there will be a
        ``terms`` field which indicates the terms in the model. Then there may
        be a ``name`` field which will be set to ``model.name``. Depending on
        the input type, there may be ``mapping``, ``num_ancillas``, and
        ``constraints`` fields.

    Example
    -------
    >>> import qubovert as qv
    >>>
    >>> pcbo = qv.PCBO({(0,): 1}).add_constraint_eq_zero({(0,): 1}, lam=0)
    >>> pcbo
    {(0,): 1}
    >>> pcbo.constraints
    {"eq": [{(0,): 1}]}
    >>> print(pcbo.name)
    None
    >>> info = qv.utils.get_info(pcbo)
    >>> info
    {"type"="PCBO", "name"=None, "terms"={(0,): 1}, "mapping"={0: 0},
     num_ancillas=0, "constraints"={"eq": [{(0,): 1}]}}
    >>> qv.utils.create_from_info(info) == pcbo
    True

    See Also
    --------
    qubovert.utils.create_from_info : opposite function.

    """
    res = dict(
        type=model.__class__.__name__,
        terms=dict(model),
        name=model.name
    )
    for attr in ("mapping", "num_ancillas", "constraints"):
        if hasattr(model, attr):
            res[attr] = getattr(model, attr)

    return res