def for_name(cls, name):
    """ Get an enum member or alias member by name """
    lowerstring = name.casefold()
    if lowerstring in cls.cache:
        return cls.cache[lowerstring]
    for ansi in cls:
        if ansi.name.casefold() == lowerstring:
            cls.cache[lowerstring] = ansi
            return ansi
    for aka, ansialias in cls.__aliases__.items():
        if aka.casefold() == lowerstring:
            for ansi in cls:
                if ansi.value == ansialias:
                    cls.cache[lowerstring] = ansi
                    return ansi
    raise LookupError(f'No ANSI code found for “{name}”')
