Finish knife cut (emulate enter key)

Does anyone know the python/bpy code to terminate a knife cut. You’ve already made all of your actual cuts, and the code would be identical to hitting ‘enter’ and just finishing up and leave knife cut mode.