async def open_websocket_client(sock: anyio.abc.SocketStream,
                                addr,
                                path: str,
                                headers: Optional[list] = None,
                                subprotocols: Optional[list] = None):
    """Create a websocket on top of a socket."""
    ws = await create_websocket_client(
        sock, addr=addr, path=path, headers=headers, subprotocols=subprotocols)
    try:
        yield ws
    finally:
        await ws.close()