code: def update_ssh_config(
      path: PathLike, host: str, options: Dict[str, str]
  ):
      Path(path).parent.mkdir(parents=True, exist_ok=True)
      with FileLock(str(path) + ".lock"):
          copy_mode = True
          content = ""
          if os.path.exists(path):
              with open(path, "r") as f:
                  for line in f:
                      m = re.match(rf"^Host\s+(\S+)$", line.strip())
                      if m is not None:
                          copy_mode = m.group(1) != host
                      if copy_mode:
                          content += line
          with open(path, "w") as f:
              f.write(content)
              if options:
                  f.write(f"Host {host}\n")
                  for k, v in options.items():
                      f.write(f"    {k} {v}\n")
              f.flush()
  
file_path: dstack/src/dstack/_internal/utils/ssh.py
imports: import os
  import re
  import subprocess
  import sys
  from pathlib import Path
  from typing import Dict, Optional
  from filelock import FileLock
  from paramiko.config import SSHConfig
  from paramiko.pkey import PKey, PublicBlob
  from dstack._internal.utils.path import PathLike
label_desc: Use image node_id 7 for calling a global function with example usage: update_ssh_config(path, host, options) without return types