def ref(self):
        ''' A Bokeh protocol "reference" to this model, i.e. a dict of the
        form:

        .. code-block:: python

            {
                'type' : << view model name >>
                'id'   : << unique model id >>
            }

        Additionally there may be a `subtype` field if this model is a subtype.

        '''
        if "__subtype__" in self.__class__.__dict__:
            return {
                'type'    : self.__view_model__,
                'subtype' : self.__subtype__,
                'id'      : self.id,
            }
        else:
            return {
                'type' : self.__view_model__,
                'id'   : self.id,
            }