def rename_ending(file: str, condition: str, ending: str)-> str:
    """
    conditional renaming of file name ending
    :param file: str file name
    :param condition: str file name ending to be compared with
    :param ending: str new ending
    :return: str
    """
    file_name = file.rsplit(".", 1)[0]
    return file_name + ending if file.endswith(condition) else file_name + condition