from typing import List


def get_model_name(key: str, model_names: List) -> str:
    """Generates a name for a pydantic model, based on already taken model names."""
    if key not in model_names:
        return key
    counter = 1
    while key + str(counter) in model_names:
        counter += 1
    return key + str(counter)