def _template(cls): ''' Examine the inheritance heirarchy of this class and construct the template. ''' d = OrderedDict() for c in cls.__mro__[::-1]: for tmpl in getattr(c, '__template__', []): d[tmpl[0]] = tmpl return d.values()