Handmade Python tokenizer