def replace_tokens(string, os_name, os_code_name, os_arch):
    """Replace RPM-specific tokens in the repository base URL."""
    for key, value in {
        '$basearch': os_arch,
        '$distname': os_name,
        '$releasever': os_code_name,
    }.items():
        string = string.replace(key, value)
    return string