def is_ref(frag):
    """ Test whether a given Bokeh object graph fragment is a reference.

    A Bokeh "reference" is a ``dict`` with ``"type"`` and ``"id"`` keys.

    Args:
        frag (dict) : a fragment of a Bokeh object graph

    Returns:
        True, if the fragment is a reference, otherwise False

    """
    return isinstance(frag, dict) and \
           frag.get('type') and \
           frag.get('id')