def append_suffix(name: str, suffix: str):
    """
    Append a suffix (e.g. numeric or layer name) to a file-like name; preserve
    the original non-numeric file extension (e.g. .fits); return the unmodified
    name if it already contains this suffix

    :param name: data file name, group name, etc.
    :param suffix: suffix to append, including separator

    :return: `name` with `suffix` appended in the appropriate place
    """
    if name.endswith(suffix):
        return name

    try:
        base, ext = name.rsplit('.', 1)
        if ext:
            # noinspection PyBroadException
            try:
                int(ext)
            except Exception:
                ext = '.' + ext
            else:
                # Numeric suffix; treat as no suffix
                raise ValueError('Numeric suffix')
    except ValueError:
        base, ext = name, None
    if base.endswith(suffix):
        return name

    name = base + suffix
    if ext:
        name += ext
    return name