code: def copy_to_websocket(
      ws: lomond.WebSocket,
      f: io.RawIOBase,
      ready_sem: threading.Semaphore,
  ) -> None:
      ready_sem.acquire()
  
      try:
          while True:
              chunk = f.read(4096)
              if not chunk:
                  break
              ws.send_binary(chunk)
      finally:
          f.close()
          ws.close()
  
imports: from __future__ import annotations
  import contextlib
  import io
  import os
  import socket
  import socketserver
  import ssl
  import sys
  import threading
  import time
  import urllib.request
  from dataclasses import dataclass
  from typing import Iterator, List, Optional, Union
  import lomond
  from determined.common.api import Session, authentication, bindings, request
label_desc: Use image node_id 1 for calling a global function with example usage: copy_to_websocket(ws, f, ready_sem) without return types