'Return config validator.'

def validator(self):

    root = validator.factory(u'dict')
    root.accept(u'text', key=u'username', required=True)
    root.accept(u'text', key=u'password', required=True)
    root.accept(u'number', key=u'gravity_multiplier')
    root.accept(u'choice', key=u'category').accept_choices(CATEGORIES[u'browse'])
    root.accept(u'number', key=u'category')
    categories = root.accept(u'dict', key=u'category')
    category_list = root.accept(u'list', key=u'category')
    category_list.accept(u'choice').accept_choices(CATEGORIES[u'browse'])
    for category in CATEGORIES:
        categories.accept(u'choice', key=category).accept_choices(CATEGORIES[category])
        categories.accept(u'boolean', key=category)
        categories.accept(u'number', key=category)
        category_list = categories.accept(u'list', key=category)
        category_list.accept(u'choice', key=category).accept_choices(CATEGORIES[category])
        category_list.accept(u'number', key=category)
    return root
