def _name_key(name):
    """Make sure that private attributes are visited last."""
    if name.startswith("_"):
        return "~" + name
    return name
Make sure that private attributes are visited last.
keras/src/saving/saving_lib.py