Python parsing logic mostly complete