def convert_extension(filename, extensions=('yaml', 'yml',)):
    """
    Convert YeT extension in filename to .tex

    :param filename: string of file name. validity not checked.
    :param extensions: tuple of extensions (without dot) to treat as YeT
    """
    # change YAML extension to .tex
    if '.' in filename:
        ext = filename.split('.')[-1]
        if ext in extensions:
            idx = filename.rindex('.')
            return f'{filename[:idx]}.tex'
    # or append .tex if appropriate extension is not found
    return f'{filename}.tex'