'Return the id of *style*, or |None| if it is the default style of
*style_type*. Raises |ValueError| if style is not of *style_type*.'

def _get_style_id_from_style(self, style, style_type):

    if (style.type != style_type):
        raise ValueError((u'assigned    style    is    type    %s,    need    type    %s' % (style.type, style_type)))
    if (style == self.default(style_type)):
        return None
    return style.style_id
