<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def writer_trampoline(start):
 """Provides the co-routine trampoline for a writer state machine. The given co-routine is a state machine that yields :class:`Transition` and takes a :class:`Transition` with a :class:`amazon.ion.core.IonEvent` and the co-routine itself. Notes: A writer delimits its logical flush points with ``WriteEventType.COMPLETE``, depending on the configuration, a user may need to send an ``IonEventType.STREAM_END`` to force this to occur. Args: start: The writer co-routine to initially delegate to. Yields: DataEvent: the result of serialization. Receives :class:`amazon.ion.core.IonEvent` to serialize into :class:`DataEvent`. """

    trans = Transition(None, start)
    while True:
        ion_event = (yield trans.event)
        if trans.event is None:
            if ion_event is None:
                raise TypeError('Cannot start Writer with no event')
        else:
            if trans.event.type is WriteEventType.HAS_PENDING and ion_event is not None:
                raise TypeError('Writer expected to receive no event: %r' % (ion_event,))
            if trans.event.type is not WriteEventType.HAS_PENDING and ion_event is None:
                raise TypeError('Writer expected to receive event')
            if ion_event is not None and ion_event.event_type is IonEventType.INCOMPLETE:
                raise TypeError('Writer cannot receive INCOMPLETE event')
        trans = trans.delegate.send(Transition(ion_event, trans.delegate))