def _intify_keys(d):
    """Make sure all integer strings in a dictionary are converted into integers."""
    assert isinstance(d, dict)
    out = {}
    for k, v in d.items():
        if isinstance(k, str) and k.isdigit():
            k = int(k)
        out[k] = v
    return out