async def METHOD_NAME(writer: asyncio.StreamWriter) -> None:
    """
    Python 3.6-compatible `asyncio.StreamWriter.wait_closed` wrapper.
    :param writer: The `asyncio.StreamWriter` to wait on.
    """
    if sys.version_info >= (3, 7):
        await writer.METHOD_NAME()
        return
    # Python 3.6
    transport = writer.transport
    assert isinstance(transport, asyncio.WriteTransport)
    while not transport.is_closing():
        await asyncio.sleep(0)
    # This is an ugly workaround, but it's the best I can come up with.
    sock = transport.get_extra_info('socket')
    if sock is None:
        # Our transport doesn't have a socket? ...
        # Nothing we can reasonably do.
        return
    while sock.fileno() != -1:
        await asyncio.sleep(0)