def get_template(template, relation):
    """ Given an entry or a category, return the path to a related template """
    if isinstance(relation, Entry):
        path = relation.category.path
    elif isinstance(relation, Category):
        path = relation.path
    else:
        path = relation

    tmpl = map_template(path, template)
    return tmpl.filename if tmpl else None
def get_template ( template , relation ) : if isinstance ( relation , Entry ) : path = relation . category . path elif isinstance ( relation , Category ) : path = relation . path else : path = relation tmpl = map_template ( path , template ) return tmpl . filename if tmpl else None
Given an entry or a category, return the path to a related template