def METHOD_NAME(item_code):
	attributes = frappe.db.get_all(
		"Item Variant Attribute",
		fields=["attribute"],
		filters={"parenttype": "Item", "parent": item_code},
		order_by="idx asc",
	)
	optional_attributes = ItemVariantsCacheManager(item_code).get_optional_attributes()
	for a in attributes:
		if a.attribute in optional_attributes:
			a.optional = True
	return attributes