code: def forward_ports(
      remote_host, local_host, local_listen_ports, remote_listen_ports
  ):
      """Forwards ports such that multiplayer works between machines.
  
      Args:
        remote_host: Where to ssh to.
        local_host: "127.0.0.1" or "::1".
        local_listen_ports: Which ports to listen on locally to forward remotely.
        remote_listen_ports: Which ports to listen on remotely to forward locally.
  
      Returns:
        The ssh process.
  
      Raises:
        ValueError: if it can't find ssh.
      """
      if ":" in local_host and not local_host.startswith("["):
          local_host = "[%s]" % local_host
  
      ssh = shutil.which("ssh") or shutil.which("plink")
      if not ssh:
          raise ValueError("Couldn't find an ssh client.")
  
      args = [ssh, remote_host]
      for local_port in local_listen_ports:
          args += [
              "-L",
              "%s:%s:%s:%s"
              % (local_host, local_port, local_host, local_port),
          ]
      for remote_port in remote_listen_ports:
          args += [
              "-R",
              "%s:%s:%s:%s"
              % (local_host, remote_port, local_host, remote_port),
          ]
  
      logging.info("SSH port forwarding: %s", " ".join(args))
      return subprocess.Popen(
          args,
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE,
          stdin=subprocess.PIPE,
          close_fds=(os.name == "posix"),
      )
  
imports: import binascii
  import collections
  import hashlib
  import json
  import os
  import shutil
  import socket
  import struct
  import subprocess
  import threading
  import time
  from absl import logging
  from pysc2 import run_configs
  from pysc2.env import sc2_env
  from pysc2.lib import features
  from pysc2.lib import run_parallel
  from s2clientprotocol import sc2api_pb2
label_desc: Use image node_id 11 for calling a global function with example usage: forward_ports(remote_host, local_host, local_listen_ports, remote_listen_ports) and returns: subprocess