def METHOD_NAME():
    """
    Return function that allows sorting keys that appear in any "object" (JSON-speak for dict).
    The sort order makes the resulting order of keys easier to digest by humans.
    Input to the sorter is a tuple of (key, value) from turning a dict into a list of items.
    Output (return value) of the sorter is a tuple of (preferred order, key name).
    If a key is not known, it's sorted alphabetically (ignoring case) after all known ones.
    """
    preferred_order = [
        # always (tables, columns, etc.)
        "name",
        "description",
        # only tables
        "source_name",
        "unload_target",
        "depends_on",
        "constraints",
        "attributes",
        "columns",
        # only columns
        "sql_type",
        "type",
        "expression",
        "source_sql_type",
        "not_null",
        "identity",
    ]
    order_lookup = {key: (i, key) for i, key in enumerate(preferred_order)}
    max_index = len(preferred_order)
    def sort_key(item):
        key, value = item
        return order_lookup.get(key, (max_index, key))
    return sort_key