def resolve_cheetah_template(change_type):
    """
    return the appropriate cheetah template class for the given change
    type, using the method-resolution-order of the change type.
    """

    tm = cheetah_template_map()

    # follow the built-in MRO for a type to find the matching
    # cheetah template
    for t in change_type.mro():
        tmpl = tm.get(t)
        if tmpl:
            return tmpl

    # this should never happen, since we'll provide a
    # change_Change template, and all of the changes should be
    # inheriting from that type
    raise Exception("No template for class %s" % change_type.__name__)
return the appropriate cheetah template class for the given change
    type, using the method-resolution-order of the change type.