'Returns a Knowledge Category instance matching the given treepath'

def by_path(path):

    category = KnowledgeCategory.objects.filter(treepath=unidecode(path))
    if category:
        category = category[0]
    else:
        category = None
    return category
