def rename(d, pair_list):
    """mutator. given a dictionary `d` and a list of (old-name, new-name) pairs, renames old-name to new-name, if it exists"""
    for old, new in pair_list:
        if old in d:
            d[new] = d[old]
            del d[old]
