def rename_keys(dist, keys):
    """
    Rename all the dictionary keys *in-place* inside a *dist*,
    which is a nested structure that could be a dict or a list.
    Hence, I named it as dist... which is much better than lict.

    >>> test = {"spam": 42, "ham": "spam", "bacon": {"spam": -1}}
    >>> rename_keys(test, ("spam", "eggs"))
    {"eggs": 42, "ham": "spam", "bacon": {"eggs": -1}}
    """

    if isinstance(dist, list):
        for item in dist:
            rename_keys(item, keys)

    elif isinstance(dist, dict):
        oldkey, newkey = keys
        if oldkey in dist:
            dist[newkey] = dist.pop(oldkey)
        for value in dist.values():
            rename_keys(value, keys)

    return dist