'Returns a KnowledgeFolder instance matching the given treepath'

def by_path(treePath):

    folder = KnowledgeFolder.objects.filter(treepath=unicode(treePath))
    if folder:
        folder = folder[0]
    else:
        folder = None
    return folder
