The async version of ``os.sendfile(...)``.

    ``out_f`` and ``in_f`` can be any object with a ``fileno()`` method, but
    they must all be set to async mode beforehand.

def sendfile_async(out_f, in_f, offset, nbytes, loop=None):
    """The async version of ``os.sendfile(...)``.

    ``out_f`` and ``in_f`` can be any object with a ``fileno()`` method, but
    they must all be set to async mode beforehand.
    """
    loop = loop or asyncio.get_event_loop()

    total_size = offset + nbytes
    cur_offset = offset
    while cur_offset < total_size:
        copied = yield from _sendfile_async(out_f, in_f,
                                            cur_offset,
                                            total_size - cur_offset,
                                            loop)
        cur_offset += copied