import random


def choose_from_follow_list(key: str, transitions: dict[str, list[str]]) -> str:
    """Return a random word from the follow list in transitions that is associated with key.

    Also remove one occurrence of the random word from the follow list. If the follow list is then
    empty, remove the key-value pair from transitions.

    Preconditions:
        - transitions != {}
        - key in transitions
        - transitions[key] != []
    """
    word = random.choice(transitions[key])
    transitions[key].remove(word)

    if len(transitions[key]) == 0:
        del transitions[key]

    return word