<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def blocking_writer(writer, output):
 """Provides an implementation of using the writer co-routine with a file-like object. Args: writer (Coroutine):
 A writer co-routine. output (BaseIO):
 The file-like object to pipe events to. Yields: WriteEventType: Yields when no events are pending. Receives :class:`amazon.ion.core.IonEvent` to write to the ``output``. """

    result_type = None
    while True:
        ion_event = (yield result_type)
        for result_event in _drain(writer, ion_event):
            output.write(result_event.data)
        result_type = result_event.type