<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wrap_iter_with_message_events( request_or_response_iter, span, message_event_type ):
 """Wraps a request or response iterator to add message events to the span for each proto message sent or received """

    for message_id, message in enumerate(request_or_response_iter, start=1):
        add_message_event(
            proto_message=message,
            span=span,
            message_event_type=message_event_type,
            message_id=message_id
        )
        yield message