'Construct an new :class:`.NodeItem` from a `WidgetDescription`.
Optionally also set `CategoryDescription`.'

def new_node_item(self, widget_desc, category_desc=None):

    item = items.NodeItem()
    item.setWidgetDescription(widget_desc)
    if ((category_desc is None) and self.registry and widget_desc.category):
        category_desc = self.registry.category(widget_desc.category)
    if ((category_desc is None) and (self.registry is not None)):
        try:
            category_desc = self.registry.category(widget_desc.category)
        except KeyError:
            pass
    if (category_desc is not None):
        item.setWidgetCategory(category_desc)
    item.setAnimationEnabled(self.__node_animation_enabled)
    return item
