from Antonio Ospite (ao2) wrap bmesh sort function for python api, eg: bm.faces.sort(key=lambda f: f.material_index)