'Register a :class:`WidgetDescription` instance.'

def register_widget(self, desc):

    if (not isinstance(desc, description.WidgetDescription)):
        raise TypeError(("Expected    a    'WidgetDescription'    got    %r." % type(desc).__name__))
    if self.has_widget(desc.qualified_name):
        raise ValueError(('%r    already    exists    in    the    registry.' % desc.qualified_name))
    category = desc.category
    if (category is None):
        category = 'Unspecified'
    if self.has_category(category):
        cat_desc = self.category(category)
    else:
        log.warning('Creating    a    default    category    %r.', category)
        cat_desc = description.CategoryDescription(name=category)
        self.register_category(cat_desc)
    self._insert_widget(cat_desc, desc)
