def changes_dict_to_set_attribute(metakey, changes_dict, end=";"):
    """Convert dictionart of changes to set_attribute instructions"""
    result = []
    for key, (value, old) in changes_dict.items():
        result.append("set_attribute({!r}, {!r}, {!r}, old={!r})".format(metakey, key, value, old))
    return "\n".join(result) + end