def rcoro_proc(coro=None):
    import os
    # receive object from client_proc coroutine
    cobj = yield coro.receive()
    if not cobj:
        raise StopIteration
    # Input file is already copied at where this rcoro is running (by client).
    # For given input file, create an output file with each line in the output
    # file computed as length of corresponding line in input file
    inp_file = 'input%s.dat' % cobj.i
    out_file = 'output%s.dat' % cobj.i
    with open(inp_file, 'r') as inp_fd:
        with open(out_file, 'w') as out_fd:
            for lineno, line in enumerate(inp_fd, start=1):
                out_fd.write('%d: %d\n' % (lineno, len(line)-1))
    # 'sleep' to simulate computing
    yield coro.sleep(cobj.n)
    # transfer the output file to client's asyncoro
    result = yield asyncoro.AsynCoro().send_file(cobj.client.location, out_file, overwrite=True,
                                                 timeout=30)
    cobj.client.send(result)
    os.remove(inp_file)
    os.remove(out_file)


# this generator function is used to create local coroutine (at the
# client) to communicate with a remote coroutine
dataset/ETHPy150Open pgiri/asyncoro/examples/discoro_client4.py/rcoro_proc/original