import re


def ends_in_file(path):
    """ Return True when path ends with '.%ext' or '%fn' """
    _RE_ENDEXT = re.compile(r"\.%ext[{}]*$", re.I)
    _RE_ENDFN = re.compile(r"%fn[{}]*$", re.I)
    return bool(_RE_ENDEXT.search(path) or _RE_ENDFN.search(path))