Yield Erlang terms from an input stream.

def recv_loop(stream):
    """Yield Erlang terms from an input stream."""
    message = recv(stream)
    while message:
        yield message
        message = recv(stream)