Implement transition(order, event) as a pure transition function. The order is a dictionary with a string status and arbitrary extra fields; event is a string.
Allowed transitions are:
- draft + submit -> awaiting_payment
- draft + cancel -> cancelled
- awaiting_payment + pay -> paid
- awaiting_payment + cancel -> cancelled
- paid + ship -> shipped
Every other combination raises ValueError, including unknown statuses/events and all events after shipped or cancelled. Do not silently accept repeated events. On success return a new dictionary preserving every extra field and changing only status. Never mutate the input, including on rejection. This task models state validity only, not payments or external side effects.
orders.py is the module src/orders.py of the src package, as the import in test_public.py shows.