def _replace_roman_numerals(name):
    if name is None or name == '':
        raise Exception

    words = name.split(' ')
    for i, word in enumerate(words):
        if i == 0:
            continue

        if i == len(words) - 1 and word == 'i':
            words[i] = str(1)
            return ' '.join(words)

        if word in roman_numerals:
            words[i] = str(roman_numerals.index(word) + 2)
            return ' '.join(words)

    return name
dataset/ETHPy150Open divijbindlish/movienamer/movienamer/sanitize.py/_replace_roman_numerals/original